zsh-users
 help / color / mirror / code / Atom feed
From: Patrick Aussems <zyk@bugfactory.org>
To: zsh-users@sunsite.auc.dk
Subject: Floating point calculus error...
Date: 25 Aug 2002 17:22:20 +0200	[thread overview]
Message-ID: <1030288941.517.8.camel@Amok> (raw)

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



             reply	other threads:[~2002-08-25 15:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-25 15:22 Patrick Aussems [this message]
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

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=1030288941.517.8.camel@Amok \
    --to=zyk@bugfactory.org \
    --cc=zsh-users@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).