7 use Scalar
::Util qw
/looks_like_number/;
10 our @ISA = qw(Exporter DynaLoader);
12 our @EXPORT_OK = qw( is_similar );
13 use constant MAX_DOUBLE
=> 1.7976931348623157e+308;
14 use constant MIN_DOUBLE
=> 2.2250738585072014e-308;
15 use constant MAX_FLOAT
=> 3.40282347e+38;
16 use constant MIN_FLOAT
=> 1.175494351e-38;
21 Math::GSL - Perl interface to the GNU Scientific Library (GSL) using SWIG
31 use Math::GSL::RNG qw/:all/;
36 Jonathan Leto, C<< <jonathan@leto.net> >> and Thierry Moisan C<< <thierry.moisan@gmail.com> >>
40 Please report any bugs or feature requests to the authors directly.
45 You can find documentation for this module with the perldoc command.
49 or online at L<http://leto.net/code/Math-GSL/>
53 =item * AnnoCPAN: Annotated CPAN documentation
55 L<http://annocpan.org/dist/Math::GSL>
59 L<http://cpanratings.perl.org/d/Math::GSL>
63 L<http://search.cpan.org/dist/Math::GSL>
68 =head1 ACKNOWLEDGEMENTS
71 =head1 COPYRIGHT & LICENSE
73 Copyright 2008 Jonathan Leto, Thierry Moisan all rights reserved.
75 This program is free software; you can redistribute it and/or modify it
76 under the same terms as Perl itself.
82 my ($self,$args) = @_;
83 my $class = ref $self || $self || 'Math::GSL';
88 # sync this with Build.PL's list of subsystems
103 my ($self,$results,$class, $eps) = @_;
105 while (my($k,$v)=each %$results){
108 $x = eval qq{${class}::$k};
113 print "got $x for $k\n" if defined $ENV{DEBUG
};
114 if(defined $x && $x =~ /nan|inf/i){
115 ok
( $v eq $x, "'$v'?='$x'" );
117 my $res = abs($x-$v);
119 : ok
( $res < $eps, "$k ?= $x, +- $res" );
125 my ($x,$y, $eps) = @_;
127 abs($x-$y) < $eps ?
1 : 0;
133 return 0 unless ( defined $x && looks_like_number
($x) );
135 return 1 if ($x == 0);
146 return 0 unless ( defined $x && looks_like_number
($x) );
148 return 1 if ($x == 0);
157 sub _has_quads
{ $Config{use64bitint
} eq 'define' || ($Config{longsize
} >= 8) }
158 sub _has_long_doubles
{ $Config{d_longdbl
} eq 'define' }
159 sub _has_long_doubles_as_default
{ $Config{uselongdouble
} eq 'define' }
160 sub _has_long_doubles_same_as_doubles
{ $Config{doublesize
} == $Config{longdblsize
} }
162 sub _assert_dies
($;$)
164 my ($code,$msg) = @_;
165 my $status = eval { &$code };
166 print "status=||$status||\n\$\?=$?\n\$\!=$!\n" if 0;
167 $@ ? ok
(1, $msg) : ok
(0, join "\n", $@
, $msg );