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 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