2024-01-06 09:44:06 +01:00
%define perl_major_ver %(eval `perl -V:version`; echo ${version%*.[0-9]*}.0)
Name : perl-Test-Number-Delta
2024-01-06 09:44:06 +01:00
Version : 1.06
Release : 1mamba
2024-01-06 09:44:06 +01:00
Summary : Test::Number::Delta - Compare the difference between numbers against a given tolerance
Group : System/Libraries/Perl
Vendor : openmamba
Distribution : openmamba
2024-01-06 09:44:06 +01:00
Packager : Silvan Calarco <silvan.calarco@mambasoft.it>
URL : https://www.cpan.org/
Source : https://cpan.metacpan.org/modules/by-module/Test/Test-Number-Delta-%{version} .tar.gz
2024-01-06 09:44:06 +01:00
License : GPL, Artistic
2024-01-06 09:44:06 +01:00
## AUTOBUILDREQ-BEGIN
BuildRequires : perl-devel
## AUTOBUILDREQ-END
2024-01-06 09:44:06 +01:00
BuildRequires : perl-devel >= %perl_major_ver
2024-01-06 09:44:06 +01:00
Requires : perl >= %perl_major_ver
2024-01-06 09:44:06 +01:00
%description
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 i s n o t e q u a l t o $ q t o w i t h i n $ e p s i l o n " ;
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).
%prep
%setup -q -n Test-Number-Delta-%{version}
%build
2024-01-06 09:44:06 +01:00
%{__perl} Makefile.PL PREFIX=%{_prefix} INSTALLDIRS=vendor OPTIMIZE=" %{optflags} "
%make
%make test
2024-01-06 09:44:06 +01:00
%install
[ " %{buildroot} " != / ] && rm -rf " %{buildroot} "
2024-01-06 09:44:06 +01:00
%makeinstall _perl
2024-01-06 09:44:06 +01:00
packlist=`find %{buildroot} -name .packlist`
[ -z " $ p a c k l i s t " ] && exit 1 || cat $packlist | \
2024-01-06 09:44:06 +01:00
sed " s , %{buildroot} , , g ; s , . * / m a n / . * , & . g z , g " | \
sort -u > .packlist && rm -f $packlist
2024-01-06 09:44:06 +01:00
strid=`echo $packlist | sed 's,.*auto\(.*\)/.packlist,\1,' `
for dir in `find %{buildroot} -type d | grep $strid`; do
2024-01-06 09:44:06 +01:00
echo " % d i r $ { d i r # % b u i l d r o o t } " >> .packlist
2024-01-06 09:44:06 +01:00
done
%clean
[ " %{buildroot} " != / ] && rm -rf " %{buildroot} "
%files -f .packlist
%defattr (-,root,root)
%changelog
2024-01-06 09:44:06 +01:00
* Sun May 16 2021 Automatic Build System <autodist@mambasoft.it> 1.06-1mamba
- automatic version update by autodist
2024-01-06 09:44:06 +01:00
* Thu Aug 29 2013 Automatic Build System <autodist@mambasoft.it> 1.03-3mamba
- automatic rebuild by autodist
* Wed Nov 05 2008 Silvan Calarco <silvan.calarco@mambasoft.it> 1.03-2mamba
- automatic rebuild by autodist
* Mon Oct 20 2008 gil <puntogil@libero.it> 1.03-1mamba
- package created by autospec