NAME
Test2::Bundle::Numerical - Numerical Quadmath/longdouble aware Test2 bundle
SYNOPSIS
use Test2::Bundle::Numerical qw(:all);
plan 2;
ok(1.555, 'basic pass');
is(1.555, 1.555, 'numeric equality');
DESCRIPTION
This bundle loads Test2::Plugin::Numerical and exports the full set of numeric aware test tools from Test2::Tools::Numerical.
The idea behind this bundle is to solve the dreaded quadmath/long double testing problem. If you want to write numeric tests that work correctly regardless of the underlying NV type, this bundle is hopefully for you.
Alpha version to confirm it solves my problem, first via cpantesters.
EXPORTS
- ok($;$)
-
Basic pass/fail assertion.
- is($$;$)
-
Numeric-aware equality assertion.
- isnt($$;$)
-
Numeric-aware inequality assertion. =item isnt($$;$)
Numeric-aware inequality assertion. =item is_deeply($$;$)
Deep comparison of nested structures with numeric-aware scalar comparison.
- diag($)
-
Emit diagnostic output.
- plan($;@)
-
Set the test plan or run
skip_all(). - done_testing
-
Finish the test script without an explicit plan.
- skip($;$)
-
Skip a test or tests with a reason.
- skip_all($)
-
Skip all tests with a reason.
- todo($;@)
-
Mark tests as TODO.
- pass($)
-
Declare a passing test.
- fail($)
-
Declare a failing test.
- like($$;$)
-
Assert that a string matches a regex.
- use_ok($;@)
-
Verify a module loads and imports correctly.
- is_lt($$;$)
-
Assert that one value is less than another.
- is_lte($$;$)
-
Assert that one value is less than or equal to another.
- is_gt($$;$)
-
Assert that one value is greater than another.
- is_gte($$;$)
-
Assert that one value is greater than or equal to another.
- approx_eq($$;$)
-
Approximate numeric equality using absolute tolerance.
- approx_ok($$;$)
-
Alias for
approx_eq. - vec_approx_eq($$;$)
-
Compare numeric vectors element-wise.
- vec_is($$;$)
-
Assert that two vectors are approximately equal.
- vec_ok($$;$)
-
Alias for
vec_is. - vec_isnt($$;$)
-
Assert that two vectors are not approximately equal.
- vec_ne($$;$)
-
Alias for
vec_isnt. - within_tolerance($$;$)
-
Float comparison using absolute tolerance.
- within_tol($$;$)
-
Alias for
within_tolerance. - is_quadmath($)
-
Test if the current Perl build uses quadmath NVs.
- is_long_double($)
-
Test if the current Perl build uses long double NVs.
- is_infinite($;$)
-
Assert a value is infinite.
- is_finite($;$)
-
Assert a value is finite.
- get_tolerance($)
-
Return a tolerance appropriate for the current NV type.
- float_is($$$;$)
-
Numeric float comparison with configurable rules.
- float_isnt($$$;$)
-
Assert that float values are not equal.
- float_ne($$$;$)
-
Alias for
float_isnt. - float_is_abs($$$;$)
-
Absolute tolerance float comparison.
- float_is_ulps($$$;$)
-
ULP-based float comparison.
- float_is_relative($$$;$)
-
Relative tolerance float comparison.
- float_ok($$$;$)
-
Boolean float comparison using the default tolerance.
- float_cmp($$;$)
-
Compare numeric values with tolerance, returning
-1,0, or1. - ulp_equal($$;$)
-
Assert two floats are within a ULP distance.
- ulp_distance($$;$$$)
-
Compute float ULP distance, or compare it against a threshold.
- relatively_equal($$;$)
-
Check relative equality within a tolerance.
- relative_tolerance($;$)
-
Return a relative tolerance.
- bits_equal($$;$)
-
Compare raw float bit patterns.
- bits_ok($$$)
-
Assert exact float bit equality.
- bits_compare($$)
-
Compare float bit representations.
- bits_diff($$)
-
Return a bit-difference string.
- bits_hex($)
-
Return the hex representation of a float's bits.
- nan_ok($;$)
-
Assert a value is NaN.
- nan_is($$$)
-
Assert that two values are both NaN or both equal.
- nan_equal($$;$)
-
Compare values treating NaN as equal.
- nv_info
-
Return information about the current NV type.
- nv_epsilon
-
Return the machine epsilon for the current NV type.
- nv_digits
-
Return the decimal digits of precision for the current NV type.
AUTHOR
LNATION, <email at lnation.org>
BUGS
Please report any bugs or feature requests to bug-Test2-Bundle-Numerical at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Test2-Bundle-Numerical. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Test2::Bundle::Numerical
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Test2-Bundle-Numerical
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
This software is Copyright (c) 2026 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)