How do I create or test for NaN or infinity in Perl?

后端 未结 6 1473
谎友^
谎友^ 2020-12-06 09:07

How do I create or test for NaN or infinite values in Perl?

6条回答
  •  死守一世寂寞
    2020-12-06 09:53

    Use Data::Float from CPAN. It exports the following functions:

    • float_is_infinite()
    • float_is_nan()
    • ...

    And contrary to the others half-working solutions posted here, it has a testsuite.

提交回复
热议问题