From: Martin P. <pru...@gm...> - 2009-11-05 18:29:34
|
On Wed, Nov 4, 2009 at 8:39 PM, myso <my...@se...> wrote: > double value = fmod(range, tempSS); //the result was 0,04 which is wrong, > because it should be zero With a bit of debug gdb showed the MS supplied msvcrt in my computer (0x77c2ced0 in msvcrt!fmod \(\) from C:\WINDOWS\system32\msvcrt.dll). Since the msdn site for the function did not show any restriction about the parameters this maybe are a MS problem. > if(value != 0) > { > //program jumped here so the zero doesn't seem to be a real zero > } You are right, this way is not safe to check floats and doubles, check http://www.cygnus-software.com/papers/comparingfloats/Comparing%20floating%20point%20numbers.htm. Martin |