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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cb3f9900b9cf2da6 X-Google-Attributes: gid103376,public From: l117593@cliffy.lfwc.lockheed.com (Cordes MJ) Subject: Re: Truncation of FLOAT values Date: 1996/04/20 Message-ID: <4lal5h$4qb@cliffy.lfwc.lockheed.com>#1/1 X-Deja-AN: 150488548 references: <4l5nmq$fhv@inrou.erno.de> <4l6bjn$b96@cliffy.lfwc.lockheed.com> organization: Lockheed Martin Tactical Aircraft Systems newsgroups: comp.lang.ada Date: 1996-04-20T00:00:00+00:00 List-Id: 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 ---------------------------------------------------------------------