File perl-Math-BigInt.spec of Package perl-Math-BigInt
#
# spec file for package perl-Math-BigInt
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: perl-Math-BigInt
Version: 1.997
Release: 1
License: GPL-1.0+ or Artistic-1.0
%define cpan_name Math-BigInt
Summary: Arbitrary size integer/float math package
Url: http://search.cpan.org/dist/Math-BigInt/
Group: Development/Libraries/Perl
Source: http://www.cpan.org/authors/id/P/PJ/PJACKLAM/%{cpan_name}-%{version}.tar.gz
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl
BuildRequires: perl-macros
Recommends: perl(bignum) >= 0.22
Recommends: perl(Math::BigInt::FastCalc) >= 0.25
Recommends: perl(Math::BigInt::GMP) >= 1.35
Recommends: perl(Math::BigInt::Pari) >= 1.15
Recommends: perl(Math::BigRat) >= 0.2602
%{perl_requires}
%description
All operators (including basic math operations) are overloaded if you
declare your big integers as
$i = new Math::BigInt '123_456_789_123_456_789';
Operations with overloaded operators preserve the arguments which is
exactly what you expect.
* Input
Input values to these routines may be any string, that looks like a
number and results in an integer, including hexadecimal and binary
numbers.
Scalars holding numbers may also be passed, but note that non-integer
numbers may already have lost precision due to the conversion to float.
Quote your input if you want BigInt to see all the digits:
$x = Math::BigInt->new(12345678890123456789); # bad
$x = Math::BigInt->new('12345678901234567890'); # good
You can include one underscore between any two digits.
This means integer values like 1.01E2 or even 1000E-2 are also accepted.
Non-integer values result in NaN.
Hexadecimal (prefixed with "0x") and binary numbers (prefixed with "0b")
are accepted, too. Please note that octal numbers are not recognized by
new(), so the following will print "123":
perl -MMath::BigInt -le 'print Math::BigInt->new("0123")'
To convert an octal number, use from_oct();
perl -MMath::BigInt -le 'print Math::BigInt->from_oct("0123")'
Currently, Math::BigInt::new() defaults to 0, while Math::BigInt::new('')
results in 'NaN'. This might change in the future, so use always the
following explicit forms to get a zero or NaN:
$zero = Math::BigInt->bzero();
$nan = Math::BigInt->bnan();
'bnorm()' on a BigInt object is now effectively a no-op, since the
numbers are always stored in normalized form. If passed a string, creates
a BigInt object from the input.
* Output
Output values are BigInt objects (normalized), except for the methods
which return a string (see the SYNOPSIS manpage).
Some routines ('is_odd()', 'is_even()', 'is_zero()', 'is_one()',
'is_nan()', etc.) return true or false, while others ('bcmp()',
'bacmp()') return either undef (if NaN is involved), <0, 0 or >0 and are
suited for sort.
%prep
%setup -q -n %{cpan_name}-%{version}
find . -type f -print0 | xargs -0 chmod 644
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags}
%check
%{__make} test
%install
%perl_make_install
%perl_process_packlist
%perl_gen_filelist
%files -f %{name}.files
%defattr(-,root,root,755)
%doc BENCHMARK BUGS CHANGES CREDITS examples GOALS HISTORY LICENSE NEW README TODO
%changelog