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

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Mar 6 13:28:36 CET 2012



On Tue, 6 Mar 2012, Jonas Maebe wrote:

>
> 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).

As far as I know, Currency is always a scaled int64, and didn't interpret the
request as a request to change that. I missed probably part of the
argumentation but on the face of it, having a ABS(Currency) seems like a
reasonable request.

Michael.



More information about the fpc-pascal mailing list