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.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,548c38bb2d3e1bb6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!q1g2000yqg.googlegroups.com!not-for-mail From: Ada novice Newsgroups: comp.lang.ada Subject: Re: understanding floating point types Date: Sun, 22 Aug 2010 03:37:35 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7b0ca24f-4a5e-43a9-9f71-e4adffb98694@q1g2000yqg.googlegroups.com> References: <74406fc1-f64b-4a3e-9dd6-301f1ed467ab@w30g2000yqw.googlegroups.com> NNTP-Posting-Host: 193.11.22.91 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1282473455 10549 127.0.0.1 (22 Aug 2010 10:37:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 22 Aug 2010 10:37:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: q1g2000yqg.googlegroups.com; posting-host=193.11.22.91; posting-account=Rr9I-QoAAACS-nOzpA-mGxtAlZ46Nb6I User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 (.NET CLR 3.5.30729),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:13600 Date: 2010-08-22T03:37:35-07:00 List-Id: On Aug 22, 11:51=A0am, "Dmitry A. Kazakov" wrote: > Compare: > > =A0 =A0type My_Float is digits 1; > > My_Float'Machine_Mantissa =3D 24 (32-bit IEEE 754 is used to model it) > My_Float'Mantissa =3D 5 (=3D 4+1) > > =A0 =A0type My_Float is digits 2; > > My_Float'Machine_Mantissa =3D 24 (32-bit IEEE 754 is used to model it) > My_Float'Mantissa =3D 8 (=3D 7+1) Thanks. The Float'Machine_Mantissa remains constant in your examples with 1 and 2 precision digits. Is the Float'Machine_Mantissa a predefined value that is constant for any precision digit requested? I have a second query: Say we consider the type My_Float is digits 2. This means that between the model numbers, the resolution is 1/(2^8) with the 8 in the expression obtained as 4 X 2. Am I right? Now if we have to multiply two numbers: say a =3D 2.33 and b =3D 3.45. Does Ada first convert each operation to its nearest model number and then do the multiplication and represent the result to its nearest model number? Or does Ada do the multiplication first and then represent the result to to its nearest model number? Thanks YC