Not a solution, but What Every Computer Scientist Should Know About Floating Point Arithmetic may help you understand what is happening and how to code to avoid the problems.
update: there are many surprising/disappointing features in floating point hardware and software. If you dump the internal representations of the values in your program, you might discern what is happening. I would consider whether values are rounded or truncated when converted from double to float, for example. It appears to be handled differently in the different contexts in your program. If you know what the conversion is doing, you should be able to test and make appropriate adjustments so that the result of the conversion is what you want. Alternatively, you might use a well defined/implemented function to perform the conversion rather than relying on the compiler built-in function.
In reply to Re: [Win32, C, and way OT] C floats, doubles, and their equivalence
by ig
in thread [Win32, C, and way OT] C floats, doubles, and their equivalence
by syphilis
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |