Main > Programming > Libraries >

Test::Number::Delta 1.03

Test::Number::Delta 1.03

Sponsored Links

Test::Number::Delta 1.03 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.018 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1015
Date added: 2007-01-18
Publisher: David A. Golden

Test::Number::Delta 1.03 description

Test::Number::Delta is a Perl module to compare the difference between numbers against a given tolerance.

SYNOPSIS

# Import test functions
use Test::Number::Delta;

# Equality test with default tolerance
delta_ok( 1e-5, 2e-5, values within 1e-6);

# Inequality test with default tolerance
delta_not_ok( 1e-5, 2e-5, values not within 1e-6);

# Provide specific tolerance
delta_within( 1e-3, 2e-3, 1e-4, values within 1e-4);
delta_not_within( 1e-3, 2e-3, 1e-4, values not within 1e-4);

# Compare arrays or matrices
@a = ( 3.14, 1.41 );
@b = ( 3.15, 1.41 );
delta_ok( @a, @b, compare @a and @b );

# Set a different default tolerance
use Test::Number::Delta within => 1e-5;
delta_ok( 1.1e-5, 2e-5, values within 1e-5); # ok

# Set a relative tolerance
use Test::Number::Delta relative => 1e-3;
delta_ok( 1.01, 1.0099, values within 1.01e-3);

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 theres nothing wrong with that construct, its 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.03 Screenshot

Advertisements

Test::Number::Delta 1.03 Keywords

Bookmark Test::Number::Delta 1.03

Hyperlink code:
Link for forum:

Test::Number::Delta 1.03 Copyright

WareSeeker periodically updates pricing and software information of Test::Number::Delta 1.03 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Test::Number::Delta 1.03 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Test::Data is a Perl module to test functions for particular variable types. Free Download
Test::Singleton is a test for Singleton classes. Free Download
Convert::Number::Digits is a Perl module that convert Digits Between the Scripts of Unicode. Free Download
Text::NSP::Measures is a Perl module for computing association scores of Ngrams. Free Download
Number::Interval is a Perl module that can implement a representation of a numeric interval. Free Download
Test::Perl::Critic is a Perl module use Perl::Critic in test programs. Free Download
Test::ISBN is a Perl module to check international standard book numbers. Free Download
RiveScript is a Perl module that allows you to rendering intelligence very easily. Free Download