Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

More builtins - inf, nan

2 views
Skip to first unread message

Paul "LeoNerd" Evans

unread,
Jan 22, 2024, 3:15:06 PMJan 22
to Perl5 Porters
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

leo...@leonerd.org.uk | https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/ | https://www.tindie.com/stores/leonerd/

Philippe Bruhat (BooK)

unread,
Jan 23, 2024, 2:30:06 AMJan 23
to Perl5 Porters
On Mon, Jan 22, 2024 at 08:07:14PM +0000, Paul "LeoNerd" Evans wrote:
> 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?

perldata has this section:

> 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))
0 new messages