Date: Sun, 3 May 1998 17:25:49 +0300 (IDT) From: Eli Zaretskii To: Eric Rudd cc: djgpp AT delorie DOT com Subject: Re: Library Function qsort() Exhibits N^2 Behavior In-Reply-To: <35477151.99373E76@cyberoptics.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk 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.