[Seaside] Smalltalk float to currency how to ?

Colin Putney cputney at wiresong.ca
Tue Jan 31 15:51:14 CET 2006


Michel Bany wrote:
> 
>> I would like to see 12.60
>>
>> Is there simple way to do it ?
>> like fprintf in C/Perl world ?
>>
> Try this.
> (amount * 100) asInteger printStringAsCents.

Also, you might consider using an integer number of cents or even a 
Money class to represent money, rather than a float. Floating point 
arithmetic doesn't produce the kind of results you'd expect for money... 
if you know this already, just ignore me.

Colin



More information about the Seaside mailing list