TEST2::COMPARE::FLOAT(3pm)
π NAME π
Test2::Compare::Float β compare two values as numbers with tolerance. Yep, bestie, this is the Test2::Compare::Float(3pm) page from the Perl Programmers Reference Guide, and it's giving precise-but-chill number matching β¨π
.
β¨ DESCRIPTION β¨
Okay so this little icon is used to compare two numbers. You can also check that two numbers are not the same. It's similar to Test2::Compare::Number, but with extra checks to work around floating point representation issues π¦. iykyk.
The optional 'tolerance' parameter controls how close the two numbers must be to be considered equal. Tolerance defaults to 1e-08 β periodt π.
Note: this will fail if the received value is undefined. It must be a number, no cap. π
Note: this will fail if the comparison generates a non-numeric value warning (which will not be shown). Why? Because it must get a number. The warning is not shown as it will report to a useless line and filename. However, the test diagnostics show both values. So the tea is still there, just not in the warning π.
π₯ SOURCE π₯
The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/ β go off, open source πβ¨.
π MAINTAINERS π
Chad Granum <exodist@cpan.org>
π¦ AUTHORS π¦
Andrew Grangaard <spazm@cpan.org>
π COPYRIGHT π
Copyright Chad Granum <exodist@cpan.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://dev.perl.org/licenses/.
Byeee from the Test2::Compare::Float(3pm) page β perl v5.42.3, 2026-11-03 ππβ¨
π¦ where this page comes from
- alpine 3.24: perl-doc 5.42.3-r0 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms