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!f42g2000yqn.googlegroups.com!not-for-mail From: Ada novice Newsgroups: comp.lang.ada Subject: Re: understanding floating point types Date: Tue, 24 Aug 2010 07:36:22 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1b2df04a-c1db-4498-8eca-e82e96818600@f42g2000yqn.googlegroups.com> References: <74406fc1-f64b-4a3e-9dd6-301f1ed467ab@w30g2000yqw.googlegroups.com> <7b0ca24f-4a5e-43a9-9f71-e4adffb98694@q1g2000yqg.googlegroups.com> <37d8fbc1-fdaf-4ca9-9393-6163f2e3fa2e@s9g2000yqd.googlegroups.com> <2d2a622b-6c4a-45b7-9e3c-a565d5dbc9e3@p3g2000yqp.googlegroups.com> <5c162267-72b0-49a0-bed2-620e880612df@k10g2000yqa.googlegroups.com> <22d531ff-b6f1-44dc-8b5e-7d93f713b418@z28g2000yqh.googlegroups.com> <59c78dcf-160f-458c-ae60-1e5562a9bff3@5g2000yqz.googlegroups.com> <87wrrgjebp.fsf@hugsarin.sparre-andersen.dk> NNTP-Posting-Host: 130.240.232.147 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1282660583 27280 127.0.0.1 (24 Aug 2010 14:36:23 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 24 Aug 2010 14:36:23 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: f42g2000yqn.googlegroups.com; posting-host=130.240.232.147; 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:13703 Date: 2010-08-24T07:36:22-07:00 List-Id: On Aug 24, 4:05=A0pm, Jacob Sparre Andersen wrote: > Ada novice writes: > > I have just read the following from an Ada book by Fintan Culwin: > > ---- > > type VeryAccurate is digits 16 > > type NotAccurate is digits 2 > > > Values of the type VeryAccurate would have limited range with a high > > degree of precision. Values of the type NotAccurate would have a much > > greater range with only two digits of precision. > > ---- > > > My understanding is that using "B =3D 3.32*D + 1", a type with digits 1= 6 > > (D =3D 16) will have a higher B value and hence a higher exponent range > > -4*B to 4*B than a type with digits 2. Will a higher exponent range > > not give a higher range? > > > What am I understanding wrong here? > > You're using a random equation. > > Fintan Culwin is probably assuming that you allocate a fixed number of > bits to represent a floating point number. =A0The fewer of those bits, > which are allocated to precision, the more can be allocated to the > exponent (and thus the range). > > But in practice your compiler may choose exactly the same representation > for both of the types in the example above. > > Greetings, > > Jacob > -- > "The same equations have the same solutions." I was thinking the same regarding having "limited" number of bits available but wasn't sure. Thanks for the confirmation. Maybe what he is saying applies more to the embedded programming way of thinking. YC