Skip to content

Commit f191419

Browse files
committed
fix Math::clog etc to not get generated if libm does not have
1 parent 5d163df commit f191419

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/PDL/Math.pd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ works with native-complex data.
491491

492492
sub cequiv {
493493
my ($func, $ref) = @_;
494+
return if !PDL::Core::Dev::got_complex_version($func, 1);
494495
pp_def("c$func",
495496
GenericTypes => $AF,
496497
Pars => 'i(); complex [o] o()',

t/math.t

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use PDL::LiteF;
55
use PDL::Math;
66
use Test::PDL -atol => 0.01;
77
use Config;
8+
require PDL::Core::Dev;
89

910
is_pdl bessj0(0.5), pdl(0.9384), "bessj0";
1011
is_pdl bessj0(0), ldouble(1), "bessj0";
@@ -54,10 +55,10 @@ is_pdl erfi(erf(0.5)), pdl(0.5), "erfi (both ways)";
5455
is_pdl pdl('-2i')->csqrt, pdl('1-i');
5556
}
5657

57-
is_pdl cacosh(-1), pdl('3.141592i');
58-
is_pdl clog(-1), pdl('3.141592i');
59-
is_pdl cacos(-2), pdl('3.141592-1.316957i');
60-
is_pdl casin(-2), pdl('-1.570796+1.316957i');
58+
is_pdl cacosh(-1), pdl('3.141592i') if PDL::Core::Dev::got_complex_version('acosh', 1);
59+
is_pdl clog(-1), pdl('3.141592i') if PDL::Core::Dev::got_complex_version('log', 1);
60+
is_pdl cacos(-2), pdl('3.141592-1.316957i') if PDL::Core::Dev::got_complex_version('acos', 1);
61+
is_pdl casin(-2), pdl('-1.570796+1.316957i') if PDL::Core::Dev::got_complex_version('asin', 1);
6162

6263
{ # csqrt_up
6364
my $pi=4*atan2(1,1);

0 commit comments

Comments
 (0)