[plt-scheme] Currency and rounding?

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Wed Aug 27 14:54:01 EDT 2008

That depends on the monetary context. At the stock exchange they used  
to go the closest fraction 1/16 or 1/8. Now they go round to a decimal.

Warning: you can't really stick to pennies with integers in Scheme  
either (as Sam recommended). You need to live up to your  
"contract" (commercial), meaning check how they want decimals to be  
treated. Example: you maintain a stock portfolio with fractional  
shares (say a DRIP account) and you promise to keep track up to 4  
digits (.9999). Then the question becomes how a daily close of 42.98  
and 87.9981 shares relate to "current value". You see integers don't  
work here by themselves. You need a legal agreement, too.

-- Matthias





On Aug 27, 2008, at 2:43 PM, Grant Rettke wrote:

> On Tue, Aug 26, 2008 at 3:10 PM, Sam TH <samth at ccs.neu.edu> wrote:
>> For currency, you should *never* use inexact numbers.   The are a few
>> possibilities here:
>
> Thanks Sam.
>
> What are the standards and norm for handling things like rounding,  
> for example?
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.