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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,9b4538cfeb0c3576 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!l20g2000yqm.googlegroups.com!not-for-mail From: Henrique Newsgroups: comp.lang.ada Subject: Re: Float conversion Date: Thu, 29 Jul 2010 11:21:52 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <9e669a3b-1013-4bd1-b372-5f7dfa46d083@f42g2000yqn.googlegroups.com> <1q5zc0ais535h$.1jqwfxhj9cflc$.dlg@40tude.net> <4c519968$0$6893$9b4e6d93@newsspool2.arcor-online.net> <1d1txn4x3r5xn.1trm4gx9n87gm$.dlg@40tude.net> NNTP-Posting-Host: 201.7.145.1 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1280427713 10222 127.0.0.1 (29 Jul 2010 18:21:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 29 Jul 2010 18:21:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: l20g2000yqm.googlegroups.com; posting-host=201.7.145.1; posting-account=B_68zwoAAABo5d-uMxDzx4n-gXWKiMZT 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:12677 Date: 2010-07-29T11:21:52-07:00 List-Id: On Jul 29, 12:35=A0pm, "Dmitry A. Kazakov" wrote: > ------------------------ > var1 9.99900024414063E+02 > var4 9.99900085449219E+02 > > When rounded to 6 decimal digits both are same. But the underlying base > binary type is longer than 6 digits. > > P.S. It is always useful to think of floating point numbers as intervals > (which they are) rather than numbers. > > -- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de As I declared the type with 6 digits, I expected that it would make the comparison only for these digits (this would gave var4 =3D var1). Do I always need to manually truncate the float number to the number of desired digits before making a comparison of them?? So what is the advantage of declaring it as "digits 6"? Thanks