Mail Archives: djgpp/1998/05/03/10:27:27
On Wed, 29 Apr 1998, Eric Rudd wrote:
> As far as the DJGPP implementation of qsort is concerned, I am actually
> more worried about a problem I discovered a while ago, when I attempted
> to use qsort to do a sort based on floating-point values. Due to the
> optimizer storing one comparison value in memory, and leaving the other
> in the coprocessor stack to higher precision, the results of the
> comparison were sometimes inconsistent for equal or nearly-equal
> comparison values.
Comparing close FP values can be tricky. Maybe if you post the
comparison function, somebody could suggest ways of making it more
stable.
There's also the -ffloat-store option to GCC which might be helpful in
such situations.
- Raw text -