comp.lang.ada
 help / color / mirror / Atom feed
From: bwburnsed@aol.com (BWBurnsed)
Subject: Re: Can compilers do this?
Date: 1996/02/26
Date: 1996-02-26T00:00:00+00:00	[thread overview]
Message-ID: <4gtpsr$c9f@newsbf02.news.aol.com> (raw)
In-Reply-To: EACHUS.96Feb26114315@spectre.mitre.org

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.




  reply	other threads:[~1996-02-26  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-02-22  0:00 Can compilers do this? BWBurnsed
1996-02-23  0:00 ` Cordes MJ
1996-02-23  0:00 ` Robert Dewar
1996-02-23  0:00 ` Stuart Palin
1996-02-23  0:00 ` Mark A Biggar
1996-02-24  0:00   ` Robert A Duff
1996-02-23  0:00     ` Robert Dewar
1996-02-25  0:00   ` Robert Dewar
1996-02-23  0:00 ` Robert Dewar
1996-02-26  0:00 ` Robert I. Eachus
1996-02-26  0:00   ` BWBurnsed [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-02-26  0:00 Marin David Condic, 407.796.8997, M/S 731-93
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox