() gu...@mails.selgrad.org
() Mon, 28 Dec 2009 18:02:36 +0100
Maybe someone can comment on this
(define (cents f)
(remainder (inexact->exact (truncate (* 100 f))) 100))
Here, `truncate' is preferred because (floor -12.34) => -13.0.
Note, however, that usually it is better (less fiddly)
to
> Here, `truncate' is preferred because (floor -12.34) => -13.0.
good point :)
> Note, however, that usually it is better (less fiddly)
> to represent monetary values as integers.
yeah, I think I will use integers for such stuff in the future. my
monetary values usually don't exceed standard 32 bi
On 00:38 Sun 03 Jan , Ludovic Courtès wrote:
> 10 is the real limit, and I agree it should be documented. Would you
> like to propose a patch?
Yes, I'll see to it :)
> From: Thien-Thi Nguyen
>
> Note, however, that usually it is better (less fiddly)
> to represent monetary values as integers.
Yes, always represent money as an integer number
of cents and put in a decimal point when you
print. That is, "$16.98" is produced by
something like (money->string 1698
2010/1/3 Keith Wright :
>
> CFO: What happened to the $12,345.67?
> You: Well, you see sir, IEEE floating point...
Heh. Common misconception.
The core problem, in accounting, is that some divisions
and multiplications are allowed, and others are not. So
for example, you are allowed to divide cos