[fpc-devel] Abs(Variant) unexpected result

Rik van Kekem rik at graficalc.nl
Sun Feb 25 18:25:03 CET 2018

On 25/02/18 17:59, Michael Van Canneyt wrote:
> On Sun, 25 Feb 2018, Bart wrote:
>> On Sun, Feb 25, 2018 at 5:34 PM, Michael Van Canneyt
>> <michael at freepascal.org> wrote:
>> So, all we can do is let the compiler pick the float version for 
>> Abs(Variant)?
> It seems so. Better yet, don't use variants. They violate what Pascal 
> stands for: type safety.
> If you really _must_ use them, do any conversions explicitly.
Additionally, A warning when using variant with Abs() would be useful then.

     writeln('X = ',Abs(X));// <-- gives 6


More information about the fpc-devel mailing list