comp.lang.ada
 help / color / mirror / Atom feed
From: l117593@cliffy.lfwc.lockheed.com (Cordes MJ)
Subject: Re: Truncation of FLOAT values
Date: 1996/04/20
Date: 1996-04-20T00:00:00+00:00	[thread overview]
Message-ID: <4lal5h$4qb@cliffy.lfwc.lockheed.com> (raw)
In-Reply-To: dewar.829887687@schonberg

Robert Dewar (dewar@cs.nyu.edu) wrote:

: First, you clearly meant to say subtract rather than round,

oops!

: e.g. 2.3 - 0.5 = 1.8, conversion rounds to 2 = integer part of 2.3

: but that's wrong, because

: 3.0 - 0.5 = 2.5, which is allowed in Ada 83 to round to 2 when you want 3.

Unless you are telling me that single implementation of an Ada compiler
_may_, in practice, round 2.5 to 3 and round 3.5 to 3, you can write
an implementation specific solution. However, in the case where a 
compiler does round x.5 to x (and not x+1), the solution is less
simple.

: There is no trivial solution  to this in Ada 83, which is why the
: truncation attribues was added to Ada 95.


--
---------------------------------------------------------------------
Michael J Cordes
Phone: (817) 935-3823
Fax:   (817) 935-3800
EMail: CordesMJ@lfwc.lockheed.com
---------------------------------------------------------------------




  reply	other threads:[~1996-04-20  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-18  0:00 Truncation of FLOAT values Franz Kruse
1996-04-18  0:00 ` Cordes MJ
1996-04-19  0:00   ` Peter Hermann
1996-04-19  0:00   ` John Herro
1996-04-19  0:00     ` Robert Dewar
1996-04-22  0:00       ` John Herro
1996-04-22  0:00     ` Robert I. Eachus
1996-04-19  0:00   ` Robert Dewar
1996-04-20  0:00     ` Cordes MJ [this message]
1996-04-21  0:00       ` Robert Dewar
replies disabled

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