-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Math::c{log,acos,asin,acosh,atanh} - fix #527
- Loading branch information
Showing
3 changed files
with
32 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -489,20 +489,25 @@ works with native-complex data. | |
($yr, $yi) = polyval($cr, $ci, $xr, $xi); | ||
',); | ||
|
||
pp_def('csqrt', | ||
GenericTypes => $AF, | ||
Pars => 'i(); complex [o] o()', | ||
Doc => <<'EOF', | ||
Take the complex square root of a number choosing that with | ||
non-negative real part, i.e., a square root with a branch cut | ||
'infinitesimally' below the negative real axis, the standard choice. | ||
sub cequiv { | ||
my ($func, $ref) = @_; | ||
pp_def("c$func", | ||
GenericTypes => $AF, | ||
Pars => 'i(); complex [o] o()', | ||
Doc => <<EOF, | ||
=for ref\n | ||
Takes real or complex data, returns the complex C<$func>.\n | ||
Added in 2.099. | ||
EOF | ||
Code => q{ | ||
$TFDEGCH(PDL_CFloat,PDL_CDouble,PDL_CLDouble,PDL_CFloat,PDL_CDouble,PDL_CLDouble) tmp=$i(); | ||
tmp=csqrt(tmp); | ||
$o() = tmp; | ||
}, | ||
); | ||
Code => pp_line_numbers(__LINE__, <<EOF), | ||
\$TFDEGCH(PDL_CFloat,PDL_CDouble,PDL_CLDouble,PDL_CFloat,PDL_CDouble,PDL_CLDouble) tmp = \$i(); | ||
tmp = c$func(tmp); | ||
\$o() = tmp; | ||
EOF | ||
); | ||
} | ||
|
||
cequiv($_) for qw(sqrt log acos asin acosh atanh); | ||
|
||
pp_def('csqrt_up', | ||
GenericTypes => $AF, | ||
|
@@ -512,23 +517,16 @@ Take the complex square root of a number choosing that whose imaginary | |
part is not negative, i.e., it is a square root with a branch cut | ||
'infinitesimally' below the positive real axis. | ||
EOF | ||
Code => q{ | ||
$TFDEGCH(PDL_CFloat,PDL_CDouble,PDL_CLDouble,PDL_CFloat,PDL_CDouble,PDL_CLDouble) tmp=$i(); | ||
tmp=csqrt(tmp); | ||
if(cimag(tmp)<0){ | ||
tmp = -tmp; | ||
} | ||
$o() = tmp; | ||
}, | ||
Code => pp_line_numbers(__LINE__, <<'EOF'), | ||
$TFDEGCH(PDL_CFloat,PDL_CDouble,PDL_CLDouble,PDL_CFloat,PDL_CDouble,PDL_CLDouble) tmp = $i(); | ||
tmp = csqrt(tmp); | ||
if (cimag(tmp)<0) | ||
tmp = -tmp; | ||
$o() = tmp; | ||
EOF | ||
); | ||
|
||
pp_addpm({At=>'Bot'},<<'EOD'); | ||
=head1 BUGS | ||
Hasn't been tested on all platforms to ensure Cephes | ||
versions are picked up automatically and used correctly. | ||
=head1 AUTHOR | ||
Copyright (C) R.J.R. Williams 1997 ([email protected]), Karl Glazebrook | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters