Home > Repository > base > perl-Test-Number-Delta
At some point or another, most programmers find they need to compare floating-point numbers for equality. The typical idiom is to test if the absolute value of the difference of the numbers is within a desired tolerance, usually called epsilon. This module provides such a function for use with Test::Harness. Usage is similar to other test functions described in Test::More. Semantically, the delta_within function replaces this kind of construct:
ok ( abs($p - $q) < $epsilon, '$p is equal to $q' ) or
diag "$p is not equal to $q to within $epsilon";
While there's nothing wrong with that construct, it's painful to type it repeatedly in a test script. This module does the same thing with a single function call. The delta_ok function is similar, but either uses a global default value for epsilon or else calculates a 'relative' epsilon on the fly so that epsilon is scaled automatically to the size of the arguments to delta_ok. Both functions are exported automatically.
Because checking floating-point equality is not always reliable, it is not possible to check the 'equal to' boundary of 'less than or equal to epsilon'. Therefore, Test::Number::Delta only compares if the absolute value of the difference is less than epsilon (for equality tests) or greater than epsilon (for inequality tests).
Test-Number-Delta-1.06.tar.gz
Richiesto in compilazione da
perl-Test-Number-Delta: Test::Number::Delta - Compare the difference between numbers against a given tolerance
At some point or another, most programmers find they need to compare floating-point numbers for equality. The typical idiom is to test if the absolute value of the difference of the numbers is within a desired tolerance, usually called epsilon. This module provides such a function for use with Test::Harness. Usage is similar to other test functions described in Test::More. Semantically, the delta_within function replaces this kind of construct:ok ( abs($p - $q) < $epsilon, '$p is equal to $q' ) or
diag "$p is not equal to $q to within $epsilon";
While there's nothing wrong with that construct, it's painful to type it repeatedly in a test script. This module does the same thing with a single function call. The delta_ok function is similar, but either uses a global default value for epsilon or else calculates a 'relative' epsilon on the fly so that epsilon is scaled automatically to the size of the arguments to delta_ok. Both functions are exported automatically.
Because checking floating-point equality is not always reliable, it is not possible to check the 'equal to' boundary of 'less than or equal to epsilon'. Therefore, Test::Number::Delta only compares if the absolute value of the difference is less than epsilon (for equality tests) or greater than epsilon (for inequality tests).
| Nome: | perl-Test-Number-Delta |
| Versione: | 1.06-2mamba |
| Gruppo: | System/Libraries/Perl |
| Manutentore: | silvan |
| Licenza: | GPL, Artistic |
| Dimensione: | 36.09 kB |
| URL di origine: | https://www.cpan.org/ |
| Data di compilazione: | 2026-03-21 00:38:23 |
File sorgenti
perl-Test-Number-Delta.specTest-Number-Delta-1.06.tar.gz
Pacchetti binari e dipendenze
| x86_64 | aarch64 | i586 | |
|---|---|---|---|
| RPM creati | perl-Test-Number-Delta | perl-Test-Number-Delta | perl-Test-Number-Delta |
| Dipendenze di compilazione | perl-devel [1] | perl-devel [1] | perl-devel [1] |
Cronologia delle modifiche
| Data | Packager | Versione | Descrizione |
|---|---|---|---|
| 2026-03-21 | autodist | 1.06-2mamba | - automatic rebuild by autodist |
| 2021-05-16 | autodist | 1.06-1mamba | - automatic version update by autodist |
| 2013-08-29 | autodist | 1.03-3mamba | - automatic rebuild by autodist |
| 2008-11-05 | silvan | 1.03-2mamba | - automatic rebuild by autodist |
| 2008-10-20 | gil | 1.03-1mamba | - package created by autospec |
