[plt-scheme] Is plt-scheme appropriate for applications that use currency?

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Mon May 7 15:16:08 EDT 2007

Scott Hickey skrev:
> I have been taking a closer look at Scheme and trying to understand the numeric types. In nearly every language I've examined, the default numeric representation for numbers with a decimal place is binary floating point. Thus, asserts like *like* (actually numbers differ by language) 1.1 + 0.1 == 1.2 fail. This obviously doesn't work well in any application involving currency.
> 
> In languages like Java and Ruby, I can get around this by explicitly declaring numbers to be of type BigDecimal. In Groovy (http://groovy.codehaus.org) and Rexx (http://www.rexxla.org/), this math support is there by default for numeric literals. 
> 
> Can someone clarify what happens in plt-scheme or Scheme in general? TIA.

See

<http://www.schemers.org/Documents/Standards/R5RS/HTML/r5rs-Z-H-9.html#%_sec_6.2.2>

for info on exact numbers.

 > (+ #e1.1 #e0.1)
6/5


-- 
Jens Axel Søgaard




Posted on the users mailing list.