[fpc-pascal] Currency and ABS(-674.59)

Ludo Brands ludo.brands at free.fr
Tue Mar 6 14:56:59 CET 2012


> > There is also a lot of code in the rtl and fcl-db that supposes 
> > currency = double. Fe.
> >
> > Function CurrToStr(Value: Currency; Const FormatSettings: 
> > TFormatSettings): string; begin
> >    Result:=FloatToStrF(Value,ffGeneral,-1,0,FormatSettings);
> > end;
> >
> > Or
> >
> > TCurrencyField = class(TFloatField)
> 
> This should not be a problem as such code already works on non-i386 
> platforms where currency is a Int64 ;)
> 
> Regards,
> Sven
> 

If you don't consider all the useless type conversions being a problem ;) 

When all the platforms use a scaled Int64 (which I'm in favor of) you can't
leave such code in place. This thread started with a rounding problem caused
by such type conversions. 

Ludo




More information about the fpc-pascal mailing list