perl / ifram / javascript question

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Mar 14 15:44:45 UTC 2007


On Wed, 14 Mar 2007, Ian Petersen wrote:

> On 3/14/07, Madison Kelly <linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org> wrote:
>>  In this case the problem is Javascript is not very good at rounding.
>>  This is more of an issue because this is a financial program and a
>>  rounding error could cost me money or, worse, charge a customer too much
>>  money. Perhaps a penny here or there, but regardless, it would make me
>>  look unprofessional.
>
> In the various sources I've seen that discuss this problem, the
> solution is always to use an integer instead of a floating point, and
> count pennies instead of dollars.

    Or store monetary values as tenths of a cent, for even higher
    accuracy. It reduces the available range, but is that likely to be
    a problem?

-- 
    Chris F.A. Johnson                      <http://cfaj.freeshell.org>
    ===================================================================
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list