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: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Truncation of FLOAT values Date: 1996/04/21 Message-ID: #1/1 X-Deja-AN: 150716022 references: <4l5nmq$fhv@inrou.erno.de> <4l6bjn$b96@cliffy.lfwc.lockheed.com> <4lal5h$4qb@cliffy.lfwc.lockheed.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-04-21T00:00:00+00:00 List-Id: Michael said: "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." That seems unlikely, but rounding 2.5 to 2 and 3.5 to 4 is not only allowed, but likely to be encountered in practice (e.g. the Alsys compiler for the 386 did this). This style of rounding is called unbiased rounding, and corresponds to IEEE round-to-nearest-even. Ada 95 forbids this kind of rounding (unless you use the specific attribute), but Ada 83 certainly allows it. Also, note my discussion of problems with non-model numbers.