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

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Mar 6 13:14:50 CET 2012


On 06 Mar 2012, at 13:05, Michael.VanCanneyt at Wisa.be wrote:

> On Tue, 6 Mar 2012, Zaher Dirkey wrote:
>
>> On Mon, Mar 5, 2012 at 12:22 AM, Jonas Maebe <jonas.maebe at elis.ugent.be 
>> >wrote:
>>
>>> This particular problem could obviously be resolved by adding a
>>> currency-specific version of abs()
>>
>> Can i ask to add overload function for ABS(Currency) be a feature  
>> request
>> in FPC?
>
> Yes, please add an entry in the bugtracker.

Note that this requires compiler patching, because abs() is internal  
(it can be used in constant expressions). I would personally argue to  
do away entirely with the "treat currency as a floating point type on  
i386 so it can use the 80x87", and instead map it implementation-wise  
to int64 like on all other platforms. You may lose a bit of  
performance, but you'll gain consistency. And you won't need hacks  
like this (which, as mentioned before, only solves one particular use- 
case, and so I'm not very much in favour of doing this).


Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120306/3d4afb30/attachment.html>


More information about the fpc-pascal mailing list