unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: guign@mails.selgrad.org
To: guile-user@gnu.org
Subject: strange behaviour of (floor .)
Date: Mon, 28 Dec 2009 18:02:36 +0100	[thread overview]
Message-ID: <20091228170236.GA27921@shoikan.fritz.box> (raw)

Hej all :)

I'm a little confused by the results of (floor .) in a simple
computation to get the fractional part of a monetary value. Maybe
someone can comment on this, as especially in the last test case below
the results seem very strange to me... 

The starting point is:
guile> (rationalize (floor (* (- 12.34 (floor 12.34)) 100)) .0)
33

The actual result shoud be 34.

I tired the following simplifications:

guile> (rationalize (floor (* (- 12.34 (floor 12.34)) 100)) .0)
33
guile> (floor (* (- 12.34 (floor 12.34)) 100))
33.0
guile> (* (- 12.34 (floor 12.34)) 100)
34.0

And checked, if this might be some sort of expected behaviour:
guile> (floor 34.0)
34.0

I'm using guile 1.8.5. 

Thanks, and have a nice time :)
	Kai





             reply	other threads:[~2009-12-28 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 17:02 guign [this message]
2009-12-28 19:42 ` strange behaviour of (floor .) Paul Emsley
2009-12-28 21:25   ` guign
2010-01-03 16:17 ` Thien-Thi Nguyen
2010-01-03 17:43   ` guign
2010-01-03 20:51   ` Keith Wright
2010-01-03 20:16     ` Linas Vepstas

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091228170236.GA27921@shoikan.fritz.box \
    --to=guign@mails.selgrad.org \
    --cc=guile-user@gnu.org \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).