From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,270d47706116d3c X-Google-Attributes: gid103376,public From: Stuart Palin Subject: Re: Can compilers do this? Date: 1996/02/23 Message-ID: <4gkfs2$h19@gcsin3.geccs.gecm.com>#1/1 X-Deja-AN: 141017601 references: <4gjd6g$mfq@newsbf02.news.aol.com> content-type: text/plain; charset=us-ascii organization: GEC Marconi Avionics (Rochester) mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 1.2 (Windows; I; 16bit) Date: 1996-02-23T00:00:00+00:00 List-Id: bwburnsed@aol.com (BWBurnsed) wrote: [snip] > >Repeatedly in this code (in many files), there are places where a floating >point variable is tested to see if it is negative. However, the way it is >done is: > > if X * abs(X) < 0.0 then ... > >Is there (or was there ever) some pathological anomaly about floating >point >implementations that would make a conversion (abs) and floating point >multiply A quick guess on this is a concern over negative zero in the IEEE standard for FP numbers, though using abs and * seems overkill since I would have thought if (X <> 0.0) and then (X < 0.0) might have been better. Stuart Palin stuart.palin@gecm.com