Discussion:
More builtins - inf, nan
(too old to reply)
Paul "LeoNerd" Evans
2024-01-22 20:07:14 UTC
Permalink
Since we now have `true` and `false` builtins, in addition to the
ever-present `undef`, I wonder if folks would want two more for
slightly nicer working with floating-point numbers, being ways to get
inf and NaN.

I could write up a PPC on this but honestly it's barely 5 minutes to
actually just implement it in a PR - thoughts on whether I should just
do it?
--
Paul "LeoNerd" Evans

***@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/
Philippe Bruhat (BooK)
2024-01-23 07:24:10 UTC
Permalink
Post by Paul "LeoNerd" Evans
Since we now have `true` and `false` builtins, in addition to the
ever-present `undef`, I wonder if folks would want two more for
slightly nicer working with floating-point numbers, being ways to get
inf and NaN.
Don't we have those already?
Post by Paul "LeoNerd" Evans
Special floating point: infinity (Inf) and not-a-number (NaN)
Floating point values include the special values "Inf" and "NaN",
for infinity and not-a-number. The infinity can be also negative.
What would be those add?

(Also, possibly spell infinity as "Inf" rather that "inf".)
--
Philippe Bruhat (BooK)

The faster the climb, the swifter the fall.
(Moral from Groo The Wanderer #87 (Epic))
Loading...