From: dmeyer@dmeyer.net
To: zsh-workers@sunsite.auc.dk
Subject: Re: Floating point calculus error...
Date: Sun, 25 Aug 2002 15:02:08 -0400 [thread overview]
Message-ID: <20020825190208.GA30222@jhereg.dmeyer.net> (raw)
In-Reply-To: <20020825180708.GE6783@greux.loria.fr>
In article <20020825180708.GE6783@greux.loria.fr> you write:
> On Sun, Aug 25, 2002 at 18:32:38 +0200, David Kågedal wrote:
> > Vincent Lefevre <vincent@vinc17.org> writes:
> > > $ echo $[0.4]
> > > 0.40000000000000002
> > >
> > > I think that it should give the minimum number of decimals in such a way
> > > that when converting back to binary, one should get the same result.
> >
> > But it does.
>
> No, this is not the *minimum* number of decimal digits. 0.4 would
> be sufficient in this case.
This is a bad idea, IMHO. The number is internally represented as
0.40000000000000002, and that's what should be printed out. If you
don't like all the digits, use printf.
--
Dave Meyer
dmeyer@dmeyer.net
parent reply other threads:[~2002-08-25 19:02 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20020825180708.GE6783@greux.loria.fr>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020825190208.GA30222@jhereg.dmeyer.net \
--to=dmeyer@dmeyer.net \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).