guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

strange behaviour of (floor .)


From: guign
Subject: strange behaviour of (floor .)
Date: Mon, 28 Dec 2009 18:02:36 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]