zsh-workers
 help / color / mirror / code / Atom feed
* Re: Floating point calculus error...
       [not found]     ` <20020825180708.GE6783@greux.loria.fr>
@ 2002-08-25 19:02       ` dmeyer
  0 siblings, 0 replies; only message in thread
From: dmeyer @ 2002-08-25 19:02 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-08-25 19:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1030288941.517.8.camel@Amok>
     [not found] ` <20020825155349.GD6783@greux.loria.fr>
     [not found]   ` <87k7me2921.fsf@bix.grotte>
     [not found]     ` <20020825180708.GE6783@greux.loria.fr>
2002-08-25 19:02       ` Floating point calculus error dmeyer

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).