[fpc-pascal] Array assignment, and not-a-number

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Mon Apr 15 20:44:16 CEST 2013


Marco van de Voort wrote:
> In our previous episode, Jonas Maebe said:
>>> with an appropriate definition of the + operator without risk that an error would try to evaluate it as an ordinary arithmetic expression?
>> We don't have constant to identify a qNaN. 
> 
>>From math:
> 
>        NaN = 0.0/0.0;
>        Infinity = 1.0/0.0;
>        NegInfinity = -1.0/0.0;
> 
> 
> but of course that is just notation/convention (that 0.0/0.0 as literal
> evaluates to NaN), it doesn't mean all archs do.

Thanks for that. Initial experiment using a NaN real or nil pointer 
throws an exception as soon as it's passed as the parameter which I 
suppose is not entirely surprising. Using varnull as a placeholder seems 
safest, although it looks as though I can't initialise a variant at 
declaration... WTH, it's just a toy for the moment at least.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list