zsh-users
 help / color / mirror / code / Atom feed
* Floating point calculus error...
@ 2002-08-25 15:22 Patrick Aussems
  2002-08-25 15:53 ` Vincent Lefevre
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Patrick Aussems @ 2002-08-25 15:22 UTC (permalink / raw)
  To: zsh-users

Hi all...

I was doing some shell scripts that were supposed to add CPU usages from
the ps output... But I got puzzled when I got an answer with a 17th
decimal while adding numbers with only 1 decimal... Strange isn't it?

This behaviour can be observed by doing the following command:

zyk@Amok:/home/zyk> echo $[0.4+0.4]

The value returned is: 0.80000000000000004 which is obviously not the
correct answer... Okay, floating points numbers are inaccurate, but
still...

Patrick

PS: I don't have the time to read the mailing lists, so I don't know if
this problem has already been reported...

PS2: Please CC me on replies, I'm not subscribed to this mailing list...



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-25 18:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-25 15:22 Floating point calculus error Patrick Aussems
2002-08-25 15:53 ` Vincent Lefevre
2002-08-25 16:32   ` David Kågedal
2002-08-25 18:07     ` Vincent Lefevre
2002-08-25 16:01 ` Erik Trulsson
2002-08-25 16:37 ` Bart Schaefer

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