Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 08ab735

Browse files
committedMar 1, 2025·
Add option 'NoExport' to pp_def
Adjust inplace usage New 'noinfix' arg for 'Overload' Add tests for generated PODs Add tests for core functions
1 parent bda65d4 commit 08ab735

File tree

6 files changed

+284
-18
lines changed

6 files changed

+284
-18
lines changed
 

‎MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ t/picnorgb.t
229229
t/picrgb.t
230230
t/pp_croaking.t
231231
t/pp_line_numbers.t
232+
t/pp_pod.t
232233
t/ppt-01_ref_counting.t
233234
t/ppt-02_non_threaded.t
234235
t/ppt-03_name_munging.t

‎lib/PDL/Ops.pd

+16-5
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ EOF
128128
}
129129

130130
my $bitwise = delete $extra{Bitwise};
131+
my $export = delete $extra{Export};
131132
pp_def($name,
132133
Pars => 'a(); b(); [o]c();',
133134
OtherPars => 'int $swap',
@@ -136,6 +137,7 @@ EOF
136137
NoBadifNaN => 1,
137138
Inplace => [ 'a' ],
138139
Overload => [$op, $mutator, $bitwise],
140+
NoExport => !$export,
139141
Code => pp_line_numbers(__LINE__, <<EOF),
140142
PDL_IF_BAD(char anybad = 0;,)
141143
broadcastloop %{
@@ -184,6 +186,8 @@ ENDCODE
184186
$codestr = '$c() = ($GENERIC(c))'.$func.'($a(),$b());';
185187
}
186188
delete $extra{unsigned}; #remove the key so it doesn't get added in pp_def.
189+
my $export = delete $extra{Export};
190+
my $noinfix = delete $extra{NoInfix};
187191

188192
pp_def($name,
189193
HandleBad => 1,
@@ -192,7 +196,8 @@ ENDCODE
192196
OtherPars => 'int $swap',
193197
OtherParsDefaults => { swap => 0 },
194198
Inplace => [ 'a' ],
195-
Overload => [$funcov, $mutator],
199+
Overload => [$funcov, $mutator, undef, $noinfix],
200+
NoExport => !$export,
196201
Code => pp_line_numbers(__LINE__, <<EOF),
197202
PDL_IF_BAD(char anybad = 0;,)
198203
broadcastloop %{
@@ -232,6 +237,7 @@ sub ufunc {
232237
(map 'types('.$_->ppsym.') %{$b() = c'.$func.$_->floatsuffix.'($a());%}', @Ctypes),
233238
;
234239
}
240+
my $export = delete $extra{Export};
235241
# do not have to worry about propagation of the badflag when
236242
# inplace since only input ndarray is a, hence its badflag
237243
# won't change
@@ -242,6 +248,7 @@ sub ufunc {
242248
NoBadifNaN => 1,
243249
Inplace => 1,
244250
!$overload ? () : (Overload => $funcov),
251+
NoExport => !$export,
245252
Code => pp_line_numbers(__LINE__, <<EOF),
246253
PDL_IF_BAD(if ( \$ISBAD(a()) ) \$SETBAD(b()); else {,)
247254
$codestr
@@ -309,7 +316,7 @@ ufunc('bitnot','~',1,'unary bitwise negation',GenericTypes => $T);
309316

310317
# some standard binary functions
311318
bifunc('power',['pow','op**'],1,'raise ndarray C<$a> to the power C<$b>',GenericTypes => [@$C, @$F]);
312-
bifunc('atan2','atan2',0,'elementwise C<atan2> of two ndarrays',GenericTypes => $F);
319+
bifunc('atan2','atan2',0,'elementwise C<atan2> of two ndarrays',GenericTypes => $F, NoInfix => 1);
313320
bifunc('modulo',['MOD','op%'],1,'elementwise C<modulo> operation',unsigned=>1);
314321
bifunc('spaceship',['SPACE','op<=>'],0,'elementwise "<=>" operation');
315322

@@ -340,6 +347,7 @@ pp_def ( '_rabs',
340347
HandleBad => 1,
341348
NoBadifNaN => 1,
342349
Inplace => 1,
350+
NoExport => 1,
343351
Code => pp_line_numbers(__LINE__-1, qq{
344352
PDL_IF_BAD(if ( \$ISBAD(a()) ) \$SETBAD(b()); else,)
345353
$rabs_code
@@ -348,13 +356,14 @@ PDL_IF_BAD(if ( \$ISBAD(a()) ) \$SETBAD(b()); else,)
348356
PMFunc=>'',
349357
);
350358

351-
pp_export_nothing();
359+
# the following pp_def'ed functions will be exported
352360

353361
# make log10() work on scalars (returning scalars)
354362
# as well as ndarrays
355363
ufunc('log10','log10',0,'the base 10 logarithm', GenericTypes => $A,
356364
Exception => '$a() <= 0',
357365
NoTgmath => 1, # glibc for at least GCC 8.3.0 won't tgmath log10 though 7.1.0 did
366+
Export => 1,
358367
PMCode => <<'EOF',
359368
sub PDL::log10 {
360369
my ($x, $y) = @_;
@@ -390,12 +399,14 @@ PDL_IF_BAD(if (anybad) $PDLSTATESETBAD(b);,)
390399
sub cfunc {
391400
my ($name, $func, $make_real, $force_complex, $doc, $backcode, %extra) = @_;
392401
my $codestr = pp_line_numbers(__LINE__-1,"\$b() = $func(\$complexv());");
402+
my $export = delete $extra{Export};
393403
pp_def($name,
394404
GenericTypes=>$C,
395405
Pars => ($force_complex ? '!real ' : '').'complexv(); '.($make_real ? 'real' : '').' [o]b()',
396406
HandleBad => 1,
397407
NoBadifNaN => 1,
398408
(($make_real || $force_complex) ? () : (Inplace => 1)),
409+
NoExport => !$export,
399410
Code => pp_line_numbers(__LINE__-1, qq{
400411
PDL_IF_BAD(if ( \$ISBAD(complexv()) ) \$SETBAD(b()); else,)
401412
$codestr
@@ -414,8 +425,8 @@ PDL_IF_BAD(if ( \$ISBAD(complexv()) ) \$SETBAD(b()); else,)
414425
);
415426
}
416427

417-
cfunc('carg', 'carg', 1, 1, 'Returns the polar angle of a complex number.', undef);
418-
cfunc('conj', 'conj', 0, 0, 'complex conjugate.', undef);
428+
cfunc('carg', 'carg', 1, 1, 'Returns the polar angle of a complex number.', undef, Export => 1);
429+
cfunc('conj', 'conj', 0, 0, 'complex conjugate.', undef, Export => 1);
419430

420431
pp_def('czip',
421432
Pars => '!complex r(); !complex i(); complex [o]c()',

‎lib/PDL/PP.pm

+19-13
Original file line numberDiff line numberDiff line change
@@ -864,12 +864,13 @@ sub pp_def {
864864
}
865865
PDL::PP->printxs($obj{NewXSCode});
866866
pp_add_boot($obj{BootSetNewXS}) if $obj{BootSetNewXS};
867-
PDL::PP->pp_add_exported($name);
867+
PDL::PP->pp_add_exported($name) unless $obj{NoExport};
868868
PDL::PP::_pp_addpm_nolineno("\n".$obj{PdlDoc}."\n") if $obj{PdlDoc};
869869
PDL::PP::_pp_addpm_nolineno($obj{PMCode}) if defined $obj{PMCode};
870870
PDL::PP::_pp_addpm_nolineno($obj{PMFunc}."\n") if defined $obj{PMFunc};
871871

872872
print "*** Leaving pp_def for $name\n" if $::PP_VERBOSE;
873+
\%obj;
873874
}
874875

875876
# marks this module as deprecated. This handles the user warnings, and adds a
@@ -1390,21 +1391,23 @@ $PDL::PP::deftbl =
13901391
}),
13911392
PDL::PP::Rule::Returns::EmptyString->new("InplaceCode", []),
13921393
PDL::PP::Rule->new("InplaceDocValues",
1393-
[qw(Name SignatureObj InplaceNormalised)],
1394+
[qw(Name SignatureObj InplaceNormalised Overload? NoExport?)],
13941395
'doc describing usage inplace',
13951396
sub {
1396-
my ($name, $sig, $inplace) = @_;
1397+
my ($name, $sig, $inplace, $ovl, $noexport) = @_;
13971398
my @args = @{ $sig->args_callorder };
13981399
my %inplace_involved = map +($_=>1), my ($in, $out) = @$inplace;
13991400
my $meth_call = $args[0] eq $in;
14001401
@args = grep !$inplace_involved{$_}, @args;
14011402
my @vals = !$meth_call ? () : [
14021403
"\$$in->inplace->$name".(
1403-
!@args ? '' : "(@{[join ',', map qq{\$$_}, @args]})"
1404+
!@args ? '' : "(@{[join ', ', map qq{\$$_}, @args]})"
14041405
).";", []
14051406
];
1406-
push @vals, [ "$name(\$$in->inplace".(
1407-
!@args ? '' : ",@{[join ',', map qq{\$$_}, @args]}"
1407+
my $op = defined($ovl) ? ref($ovl) ? $ovl->[0] : $ovl : '';
1408+
my $prefix = $noexport && $op ne $name ? "$::PDLOBJ\::" : "";
1409+
push @vals, [ "$prefix$name(\$$in->inplace".(
1410+
!@args ? '' : ", @{[join ', ', map qq{\$$_}, @args]}"
14081411
).");", []];
14091412
$vals[0][1] = ["can be used inplace"];
14101413
\@vals;
@@ -1418,7 +1421,7 @@ $PDL::PP::deftbl =
14181421
my ($name, $sig, $ovl, $inplace) = @_;
14191422
confess "$name Overload given false value" if !$ovl;
14201423
$ovl = [$ovl] if !ref $ovl;
1421-
my ($op, $mutator, $bitwise) = @$ovl;
1424+
my ($op, $mutator, $bitwise, $noinfix) = @$ovl;
14221425
confess "$name Overload trying to define mutator but no inplace"
14231426
if $mutator && !$inplace;
14241427
my $one_arg = $sig->names_in == 1;
@@ -1463,24 +1466,25 @@ EOF
14631466
confess "$name error in Overload doc: !=1 output (@outs)" if @outs != 1;
14641467
my @ins = $sig->names_in;
14651468
my @vals = ["\$$outs[0] = ".(
1466-
!$one_arg ? "\$$ins[0] $op \$$ins[1]" :
1467-
$op.($op =~ /[^a-z]/ ? '' : ' ')."\$$ins[0]"
1469+
$one_arg ? $op.($op =~ /[^a-z]/ ? '' : ' ')."\$$ins[0]" :
1470+
$noinfix ? "$op \$$ins[0], \$$ins[1]" :
1471+
"\$$ins[0] $op \$$ins[1]"
14681472
).";",
14691473
["overloads the Perl '$op' operator"]
14701474
];
1471-
push @vals, ["\$$ins[0] $op= \$$ins[1];", []] if $mutator;
1475+
push @vals, ["\$$ins[0] $op= \$$ins[1];", []] if $mutator && !$one_arg;
14721476
\@vals;
14731477
}),
14741478
PDL::PP::Rule::Returns->new("OverloadDocValues", []),
14751479

14761480
PDL::PP::Rule->new([qw(UsageDoc ParamDoc)],
14771481
[qw(Name Doc? SignatureObj OtherParsDefaults? ArgOrder?
1478-
OverloadDocValues InplaceDocValues ParamDesc? Lvalue?
1482+
OverloadDocValues InplaceDocValues ParamDesc? Lvalue? Overload? NoExport?
14791483
)],
14801484
'generate "usage" section of doc',
14811485
sub {
14821486
my ($name, $doc, $sig, $otherdefaults, $argorder,
1483-
$overloadvals, $inplacevals, $paramdesc, $lvalue,
1487+
$overloadvals, $inplacevals, $paramdesc, $lvalue, $ovl, $noexport,
14841488
) = @_;
14851489
$otherdefaults ||= {};
14861490
$paramdesc ||= {};
@@ -1523,10 +1527,12 @@ EOF
15231527
push @argsets, [\@args, [], ['all arguments given']];
15241528
}
15251529
my @invocs = @$overloadvals;
1530+
my $op = defined($ovl) ? ref($ovl) ? $ovl->[0] : $ovl : '';
1531+
my $prefix = $noexport && $op ne $name ? "$::PDLOBJ\::" : "";
15261532
push @invocs, map [(!@{$_->[1]} ? '' :
15271533
@{$_->[1]} == 1 ? "\$$_->[1][0] = " :
15281534
"(".join(", ", map "\$$_", @{$_->[1]}).") = "
1529-
)."$name(".join(", ", map "\$$_", @{$_->[0]}).");",
1535+
)."$prefix$name(".join(", ", map "\$$_", @{$_->[0]}).");",
15301536
[@{$_->[2]}]], @argsets;
15311537
$argsets[0][2] = ['method call'];
15321538
$argsets[$_][2] = [] for 1..$#argsets; # they get the idea

‎lib/PDL/PP.pod

+31
Original file line numberDiff line numberDiff line change
@@ -1867,11 +1867,31 @@ supplied. This can be overridden by supplying C<InplaceDoc>.
18671867
Overload => '>',
18681868
Overload => ['+', 1], # mutator
18691869
Overload => ['|', 1, 1], # bitwise
1870+
Overload => ['atan2', 0, 0, 1], # prefix
18701871

18711872
Implements overloading of Perl operators. Documented automatically.
1873+
A C<true> fourth element (added in PDL 2.100) affects the
1874+
documentation only and signals a prefix operator on two operands.
1875+
18721876
Added in PDL 2.099. Will overload in the current C<pp_bless> package,
18731877
which defaults to C<PDL>.
18741878

1879+
=head3 NoExport
1880+
1881+
=over 4
1882+
1883+
=item NoExport => 1
1884+
1885+
=back
1886+
1887+
A function that is defined by C<pp_def> will be automatically added
1888+
to the module's export list.
1889+
1890+
By specifying a C<true> value for C<NoExport> this behaviour can be
1891+
suppressed.
1892+
1893+
Added in PDL 2.100.
1894+
18751895
=head3 ParamDesc
18761896

18771897
# in Primitive.pd
@@ -2955,6 +2975,17 @@ C<pp_export_nothing>. When called just before calling pp_done, this ensures
29552975
that your module does not export anything, for example, if you only want
29562976
programmers to use your functions as methods.
29572977

2978+
=head3 NoExport
2979+
2980+
=over 4
2981+
2982+
=item NoExport => 1
2983+
2984+
=back
2985+
2986+
By specifying a C<true> value for the key C<NoExport> in C<pp_def>, the
2987+
defined function will be exempt from being exported.
2988+
29582989
=head1 SEE ALSO
29592990

29602991
For the concepts of broadcasting and slicing check L<PDL::Indexing>.

‎t/pp_pod.t

+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
use strict;
2+
use warnings;
3+
4+
use Test::More;
5+
use PDL::PP qw(Foo::Bar Foo::Bar foobar);
6+
use Data::Dumper;
7+
$Data::Dumper::Indent = 0;
8+
$Data::Dumper::Terse = 1;
9+
$Data::Dumper::Sortkeys = 1;
10+
$Data::Dumper::Quotekeys = 0;
11+
12+
my $DEBUG = 0;
13+
14+
# call pp_def and report args
15+
sub call_pp_def {
16+
my $name = shift;
17+
my %def = @_;
18+
local *::PDLPM;
19+
my $obj = pp_def($name => %def);
20+
note Dumper(\%def) =~ s/^\{(.*)\}$/$1/r;
21+
diag $obj->{PdlDoc} if $DEBUG;
22+
$obj;
23+
}
24+
25+
# search and remove pattern in generated pod:
26+
sub find_usage {
27+
my ($obj, $str) = @_;
28+
$obj->{PdlDoc} =~ s/^\s+\Q$str\E;.*?$//m;
29+
}
30+
31+
# all checked?
32+
sub all_seen {
33+
my ($obj, $str) = @_;
34+
! ($obj->{PdlDoc} =~ /^\V*$str\V*;\V*$/m);
35+
}
36+
37+
pp_bless('Foo::Bar');
38+
39+
subtest a => sub {
40+
my $obj = call_pp_def(foo =>
41+
Pars => 'a(n)',
42+
);
43+
44+
ok find_usage($obj, 'foo($a)'), 'function call';
45+
ok find_usage($obj, '$a->foo'), 'method call';
46+
ok all_seen($obj, 'foo'), 'all seen';
47+
};
48+
49+
subtest a_n => sub {
50+
my $obj = call_pp_def(foo =>
51+
Pars => 'a(n)',
52+
NoExport => 1,
53+
);
54+
ok find_usage($obj, 'Foo::Bar::foo($a)'), 'no-exp function call';
55+
ok find_usage($obj, '$a->foo'), 'method call';
56+
ok all_seen($obj, 'foo'), 'all seen';
57+
};
58+
59+
subtest a_b_noi => sub {
60+
my $obj = call_pp_def(foo =>
61+
Pars => 'a(n); [o]b(n)',
62+
NoExport => 1,
63+
Overload => ['foo', 1],
64+
Inplace => ['a'],
65+
);
66+
ok find_usage($obj, '$b = foo $a'), 'operator';
67+
ok find_usage($obj, '$b = foo($a)'), 'function call';
68+
ok find_usage($obj, 'foo($a, $b)'), 'all args';
69+
ok find_usage($obj, '$b = $a->foo'), 'method call';
70+
ok find_usage($obj, '$a->foo($b)'), 'method, all args';
71+
ok find_usage($obj, 'foo($a->inplace)'), 'function, inplace';
72+
ok find_usage($obj, '$a->inplace->foo'), 'method, inplace';
73+
ok all_seen($obj, 'foo'), 'all seen';
74+
};
75+
76+
subtest a_b_oi => sub {
77+
my $obj = call_pp_def(foo =>
78+
Pars => 'a(n); [o]b(n)',
79+
Overload => ['foo', 1],
80+
Inplace => ['a'],
81+
);
82+
ok find_usage($obj, '$b = foo $a'), 'operator';
83+
ok find_usage($obj, '$b = foo($a)'), 'function call';
84+
ok find_usage($obj, 'foo($a, $b)'), 'all args';
85+
ok find_usage($obj, '$b = $a->foo'), 'method call';
86+
ok find_usage($obj, '$a->foo($b)'), 'method, all args';
87+
ok find_usage($obj, 'foo($a->inplace)'), 'function, inplace';
88+
ok find_usage($obj, '$a->inplace->foo'), 'method, inplace';
89+
ok all_seen($obj, 'foo'), 'all seen';
90+
};
91+
92+
subtest a_b => sub {
93+
my $obj = call_pp_def(foo =>
94+
Pars => 'a(n); [o]b(n)',
95+
);
96+
97+
ok find_usage($obj, '$b = foo($a)'), 'function call w/ arg';
98+
ok find_usage($obj, 'foo($a, $b)'), 'all arguments given';
99+
ok find_usage($obj, '$b = $a->foo'), 'method call';
100+
ok find_usage($obj, '$a->foo($b)'), 'method call, arg';
101+
ok all_seen($obj, 'foo'), 'all seen';
102+
};
103+
104+
subtest a_b_k => sub {
105+
my $obj = call_pp_def(foo =>
106+
Pars => 'a(n); [o]b(n)',
107+
OtherPars => 'int k',
108+
);
109+
110+
ok find_usage($obj, '$b = foo($a, $k)'), 'function call w/ arg';
111+
ok find_usage($obj, 'foo($a, $b, $k)'), 'all arguments given';
112+
ok find_usage($obj, '$b = $a->foo($k)'), 'method call';
113+
ok find_usage($obj, '$a->foo($b, $k)'), 'method call, arg';
114+
ok all_seen($obj, 'foo'), 'all seen';
115+
};
116+
117+
subtest ab_c_o => sub {
118+
my $obj = call_pp_def(foo =>
119+
Pars => 'a(n); b(n); [o]c(n)',
120+
Overload => '?:',
121+
);
122+
123+
ok find_usage($obj, '$c = $a ?: $b'), 'biop';
124+
ok find_usage($obj, '$c = foo($a, $b)'), 'function';
125+
ok find_usage($obj, 'foo($a, $b, $c)'), 'function, all args';
126+
ok find_usage($obj, '$c = $a->foo($b)'), 'method';
127+
ok find_usage($obj, '$a->foo($b, $c)'), 'method, all args';
128+
ok all_seen($obj, 'foo'), 'all seen';
129+
};
130+
131+
subtest ab_c_oi => sub {
132+
my $obj = call_pp_def(foo =>
133+
Pars => 'a(n); b(n); [o]c(n)',
134+
Overload => ['?:', 1],
135+
Inplace => ['a'],
136+
);
137+
138+
ok find_usage($obj, '$c = $a ?: $b'), 'biop';
139+
ok find_usage($obj, '$c = foo($a, $b)'), 'function';
140+
ok find_usage($obj, 'foo($a, $b, $c)'), 'function, all args';
141+
ok find_usage($obj, '$c = $a->foo($b)'), 'method';
142+
ok find_usage($obj, '$a->foo($b, $c)'), 'method, all args';
143+
ok find_usage($obj, '$a ?:= $b'), 'mutator';
144+
ok find_usage($obj, 'foo($a->inplace, $b)'), 'inplace function call';
145+
ok find_usage($obj, '$a->inplace->foo($b)'), 'inplace method call';
146+
ok all_seen($obj, 'foo'), 'all seen';
147+
};
148+
149+
subtest ab_c_ni => sub {
150+
my $obj = call_pp_def(foo =>
151+
Pars => 'a(n); b(n); [o]c(n)',
152+
Inplace => ['a'],
153+
NoExport => 1,
154+
);
155+
156+
ok find_usage($obj, '$c = Foo::Bar::foo($a, $b)'), 'function';
157+
ok find_usage($obj, 'Foo::Bar::foo($a, $b, $c)'), 'function, all args';
158+
ok find_usage($obj, '$c = $a->foo($b)'), 'method';
159+
ok find_usage($obj, '$a->foo($b, $c)'), 'method, all args';
160+
ok find_usage($obj, 'Foo::Bar::foo($a->inplace, $b)'), 'inplace function call';
161+
ok find_usage($obj, '$a->inplace->foo($b)'), 'inplace method call';
162+
ok all_seen($obj, 'foo'), 'all seen';
163+
};
164+
165+
subtest ab_c_o => sub {
166+
my $obj = call_pp_def(foo =>
167+
Pars => 'a(n); b(n); [o]c(n)',
168+
Overload => ['rho', 0, 0, 1],
169+
);
170+
171+
ok find_usage($obj, '$c = rho $a, $b'), 'prefix biop';
172+
ok find_usage($obj, '$c = foo($a, $b)'), 'function';
173+
ok find_usage($obj, 'foo($a, $b, $c)'), 'function, all args';
174+
ok find_usage($obj, '$c = $a->foo($b)'), 'method';
175+
ok find_usage($obj, '$a->foo($b, $c)'), 'method, all args';
176+
ok all_seen($obj, 'foo'), 'all seen';
177+
};
178+
179+
subtest ab_c_no => sub {
180+
my $obj = call_pp_def(foo =>
181+
Pars => 'a(n); b(n); [o]c(n)',
182+
Overload => ['rho', 0, 0, 1],
183+
NoExport => 1,
184+
);
185+
186+
ok find_usage($obj, '$c = rho $a, $b'), 'prefix biop';
187+
ok find_usage($obj, '$c = Foo::Bar::foo($a, $b)'), 'function';
188+
ok find_usage($obj, 'Foo::Bar::foo($a, $b, $c)'), 'function, all args';
189+
ok find_usage($obj, '$c = $a->foo($b)'), 'method';
190+
ok find_usage($obj, '$a->foo($b, $c)'), 'method, all args';
191+
ok all_seen($obj, 'foo'), 'all seen';
192+
};
193+
194+
195+
subtest a_bc => sub {
196+
my $obj = call_pp_def(foo =>
197+
Pars => 'a(n); [o]b(n); [o]c(n)',
198+
);
199+
200+
ok find_usage($obj, 'foo($a, $b, $c)'), 'multi output function call, all args';
201+
ok find_usage($obj, '($b, $c) = foo($a)'), 'multi output function call';
202+
ok find_usage($obj, '($b, $c) = $a->foo'), 'multi output method call';
203+
ok find_usage($obj, '$a->foo($b, $c)'), 'method call, all args';
204+
ok all_seen($obj, 'foo'), 'all seen';
205+
};
206+
207+
done_testing;

‎t/ufunc.t

+10
Original file line numberDiff line numberDiff line change
@@ -313,4 +313,14 @@ subtest firstnonzeroover => sub {
313313
is_pdl $a->firstnonzeroover, pdl(3, 5), "firstnonzeroover";
314314
};
315315

316+
# Some (!) of these fail when exported:
317+
subtest core_functions => sub {
318+
ok approx(sin(1), &CORE::sin(1)), 'sin 1'; # !
319+
ok approx(cos(1), &CORE::cos(1)), 'cos 1'; # !
320+
ok approx(sqrt(2), &CORE::sqrt(2)), 'sqrt 2'; # !
321+
ok approx(exp(1), &CORE::exp(1)), 'exp 1';
322+
ok approx(log(2), &CORE::log(2)), 'log 2';
323+
ok approx(atan2(1, 1), &CORE::atan2(1, 1)), 'atan2 1, 1';
324+
};
325+
316326
done_testing;

0 commit comments

Comments
 (0)
Please sign in to comment.