comp.lang.ada
 help / color / mirror / Atom feed
From: firth@sei.cmu.edu (Robert Firth)
Subject: Re: Getting the integer part of a real
Date: Fri, 7-Nov-86 08:47:38 EST	[thread overview]
Date: Fri Nov  7 08:47:38 1986
Message-ID: <389@aw.sei.cmu.edu.sei.cmu.edu> (raw)
In-Reply-To: 38000034@gypsy.UUCP

Given

	x : float;
	i : integer;

then the line

	if (i > x) then ...

won't work, since ">" isn't defined between integers
and floats.  This is perhaps what is meant:

	if float(i) > x then ...

However, this does not really help the hard-core numerical
programmer, who most likely wants X rounded but left in
FLOATING representation - since otherwise he can use only
a very restricted subrange of float.

What we really need is the set


	function FLOOR (X : FLOAT) return FLOAT;
		 CEIL
		 ROUND
		 TRUNC

and let's make them generic in the domain type.

  reply	other threads:[~1986-11-07 13:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1986-11-05 14:25 Getting the integer part of a real emery
1986-11-07 13:47 ` Robert Firth [this message]
1986-11-07 14:27 ` Arny B. Engelson
1986-11-10 22:12   ` David desJardins
1986-11-07 15:31 ` emery
  -- strict thread matches above, loose matches on Subject: below --
1986-11-12 13:34 Hazel
replies disabled

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