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-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!feeder.erje.net!eternal-september.org!.POSTED!not-for-mail From: Warren Newsgroups: comp.lang.ada Subject: Re: Float conversion Date: Thu, 29 Jul 2010 15:37:55 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <9e669a3b-1013-4bd1-b372-5f7dfa46d083@f42g2000yqn.googlegroups.com> <1q5zc0ais535h$.1jqwfxhj9cflc$.dlg@40tude.net> Injection-Date: Thu, 29 Jul 2010 15:37:55 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="9f8M0iN5t54V+4DF/iqO8g"; logging-data="20110"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+2DMtAxCuPEde4+RXpbNKZ2OXW0FruZUI=" User-Agent: Xnews/5.04.25 X-Face: &6@]C2>ZS=NM|HE-^zWuryN#Z/2_.s9E|G&~DRi|sav9{E}XQJb*\_>=a5"q]\%A;5}LKP][1mA{gZ,Q!j Cancel-Lock: sha1:XgizAKqKr2IcQp9mA71DkQfQhOA= Xref: g2news1.google.com comp.lang.ada:12671 Date: 2010-07-29T15:37:55+00:00 List-Id: Dmitry A. Kazakov expounded in news:1q5zc0ais535h$.1jqwfxhj9cflc$.dlg@ 40tude.net: > On Thu, 29 Jul 2010 05:23:42 -0700 (PDT), Henrique wrote: > >> I have some problems in converting float variables in Ada. Look at the >> code below. >> >> Why var4 is not equal var1? > > Because they are not. Floating-point operations are inexact. I.e. "... inexact for _all_ numbers". Some fractions do express themselves exactly in binary (like 0.5). That is why it may "seem" to work some of the time ;-) Warren