unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* strange behaviour of (floor .)
@ 2009-12-28 17:02 guign
  2009-12-28 19:42 ` Paul Emsley
  2010-01-03 16:17 ` Thien-Thi Nguyen
  0 siblings, 2 replies; 7+ messages in thread
From: guign @ 2009-12-28 17:02 UTC (permalink / raw)
  To: guile-user

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





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

end of thread, other threads:[~2010-01-03 20:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-28 17:02 strange behaviour of (floor .) guign
2009-12-28 19:42 ` 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

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