1. Phix feature request

would it be possible to get the below function or are these already available?

Thanks richard

Syntax atom Result = NaN() Description Returns the special floating-point value representing 'Not a Number'. This value is returned from invalid calculations such as calculating the square root of a negative number.

Syntax atom Result = Infinity() Description Returns the special floating-point value representing positive infinity. Negative infinity can be calculated using "-Infinity()".

Syntax atom Result = IsInfinity(Value/Var) Description Returns nonzero if the input value represents positive or negative infinity and zero otherwise.

Syntax atom Result = IsNaN(Value/Var) Description Returns nonzero if the given value 'Not a Number' and zero otherwise. This value is the result of some invalid calculations. It can also be generated using the NaN() function.

new topic     » topic index » view message » categorize

2. Re: Phix feature request

Take a look at builtins/VM/pprintfN.e - specifically the atoms inf and nan (NB: the functions Inf() and Nan() are thread-safe string "inf"/"nan" and you can/should ignore them for now).

I can't quite remember why I changed inf from 1e300*1e300 to #ilASM{}, but I suspect it was to allow pmain.e/pilx86.e to do some compile-time multiplications.
Somewhere else in the backend, I forget where, possibly long since overwritten, I seem to recall I had to do a binary comparison of these things...

Anyway, in the first instance what you should do is build your own builtins/infnan.e, for your own private use, which might be quite trivial, and if (with whatever help you need) it does what you need and other people want it, and there's a decent test set, and some reasonable quality draft documentation, and no-one starts arguing over whether nan=nan or nan!=nan or whatever, then and only then I'll consider adopting it into a future release. smile

Pete

new topic     » goto parent     » topic index » view message » categorize

3. Re: Phix feature request

Pete - mille grazie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu