Representing money in software

Brent Fulgham <>
Mon Jan 2 20:26:36 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jan 2, 2006, at 9:10 AM, David Hopwood wrote:

> [resend to the list; I accidentally sent it only to the poster]
>
> David Hopwood wrote:
>> Erlang Questions wrote:
>>
>>> I was afraid about that.
>>> Unfortunately, these numbers represent money in my application :o(
>>
>>
>> It sounds like your basic problem is that you don't have an  
>> unambiguous
>> specification of how your application should handle money. This  
>> should
>> enumerate *all* of the monetary calculations that your app needs  
>> to implement,
>> and for each one, it should specify:

I used to write financial software for a living.  We ALWAYS used  
integers to represent the amounts (US cents).  Displays were shown in  
dollars by dividing by 100...

I would recommend a shift to using pure integers (perhaps in tens or  
hundredths of a Euro) for your data.

Thanks,

- -Brent
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (Darwin)

iD8DBQFDuX5tzGDdrzfvUpURAsz8AJ9f+MoLhzCr6rzKnWRgFR6t44bAAACfVdvX
p5bRoCLhwFIvOoGqCF7+M+o=
=qlB4
-----END PGP SIGNATURE-----



More information about the erlang-questions mailing list