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=0.6 required=5.0 tests=BAYES_40,FREEMAIL_FROM, 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: bwburnsed@aol.com (BWBurnsed) Subject: Re: Can compilers do this? Date: 1996/02/26 Message-ID: <4gtpsr$c9f@newsbf02.news.aol.com>#1/1 X-Deja-AN: 141288194 sender: root@newsbf02.news.aol.com references: organization: America Online, Inc. (1-800-827-6364) newsgroups: comp.lang.ada Date: 1996-02-26T00:00:00+00:00 List-Id: I have read with interest the replies to my message. I can see that we shall have to check with our specific vendor to know whether or not this (validated!) compiler suffers from the signed zero syndrome. The discussion of "clipping" near zero is very interesting. Allow me to elaborate (so to speak) on more of the surrounding code. Actually, they provided a function (which I shall refer to as "clip") that was implemented thus (only the names have been changed, to protect the...): function Clip ( x : some_float_type; Z : some_float_type ) return some_float_type is begin if abs(x) <= Z then return 0.0; else return x; end if; end; But-- when it came to employing this function, it goes something like: tmp_x : some_float_type; abs_x : some_float_type; ... tmp_x := {some calculation} ; abs_x := clip ( abs(tmp_x), 0.01 ); if tmp_x * abs_x < 0.0 then final_answer := tmp_x; else final_answer := -tmp_x; end if; There are also examples of simply using if X * abs(X) < 0.0 then.. but the above astounds me more.