roundFloatToInt is broken! WTF!


#1

why in the name of all that is holy would roundFloatToInt() work fine in a Debug build but return NOTHING BUT ZEROS in me release build!!!

lost days tracking that bastard down!!! been up several extensive wrong trees.

replaced with cast and working good enough.

numbers going in were not wierd or anything. (EG 423.234)

?


#2

The only time I saw it go wrong was in an old build on gcc, where it was getting optimised incorrectly. That’s why I changed it to use a union, which should be guaranteed to do the right thing. What platform are you on?


#3

windows xp sp 2

juce in dll (dont ask!)

discrepency of build settings? optimizations?


#4

I guess it could be a struct alignment issue - if the union it uses got misaligned then that could cause it. Would expect it to be the same in debug though.


#5

right. sorted.

the juce.dll was using fp:precise and my .exe was using fp:fast

fair enough eh?


#6

Ah, that’d explain it.


#7