comp.lang.ada
 help / color / mirror / Atom feed
From: mcsun!sun4nl!cwi.nl!dik@uunet.uu.net  (Dik T. Winter)
Subject: Re: Red-faced professor gets bitten in search for portability
Date: 22 Nov 91 22:11:26 GMT	[thread overview]
Message-ID: <4766@charon.cwi.nl> (raw)

What is ignored in this thread is that floating-point arithmetic is a bit
indeterminate.  I will point to the problems in this version:

In article <1991Nov22.090650.28@v7.vitro.com> vaxs09@v7.vitro.com writes:
 > 	FUNCTION Trunc ( X : Float ) RETURN Integer IS
 > 		i : integer := integer ( x );
 > 		if x < float(i) then
What if x is the largest machine number smaller than i?  In that case it is
most probable that x is not a model number, so it is in the middle of a
model interval.  We find that the comparison is allowed to deliver both
true and false in this case.  On some machines you will indeed find false!
Even the comparison "x > float(i)" is allowed to return true (but I do not
know machines where that will happen).  The LRM clearly states what happens
when you compare numbers in different model intervals, or when you compare
different model numbers.  It also says that comparison of numbers in the
same model interval is indeterminate.

 > 			return i - 1;
 > 		else
 > 			return i;
 > 		endif;
 > 	END Trunc;


--
dik t. winter, cwi, kruislaan 413, 1098 sj  amsterdam, nederland
dik@cwi.nl (from bitnet also probably: dik@mcvax)

             reply	other threads:[~1991-11-22 22:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1991-11-22 22:11 Dik T. Winter [this message]
  -- strict thread matches above, loose matches on Subject: below --
1991-11-25  6:09 Red-faced professor gets bitten in search for portability csus.edu!wupost!spool.mu.edu!munnari.oz.au!metro!cluster!swift!sunaus!ass
1991-11-22 22:16 Dik T. Winter
1991-11-22 21:10 Jonathan Parker
1991-11-22 15:24 The Sunset Kid
1991-11-22 14:06 psinntp!vitro.com!v7.vitro.com!vaxs09
1991-11-22  2:29 micro-heart-of-gold.mit.edu!wupost!zaphod.mps.ohio-state.edu!uakari.prima
1991-11-20 23:59 micro-heart-of-gold.mit.edu!wupost!sdd.hp.com!uakari.primate.wisc.edu!use
1991-11-20  2:55 csus.edu!wupost!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM!newstop!s
1991-11-19 15:06 Norman H. Cohen
1991-11-16  0:01 Michael Feldman
1991-11-15 20:58 Mike Murphy
1991-11-15 18:59 Michael Feldman
replies disabled

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