math.pd (PDL-2.078) | : | math.pd (PDL-2.079) | ||
---|---|---|---|---|
skipping to change at line 296 | skipping to change at line 296 | |||
Code => ' | Code => ' | |||
PDL_IF_BAD(if ( $ISBAD(a()) ) { $SETBAD(b()); $SETBAD(s()); } else {, ) | PDL_IF_BAD(if ( $ISBAD(a()) ) { $SETBAD(b()); $SETBAD(s()); } else {, ) | |||
$b() = lgamma($a()); | $b() = lgamma($a()); | |||
$s() = tgamma($a()) < 0 ? -1 : 1; | $s() = tgamma($a()) < 0 ? -1 : 1; | |||
PDL_IF_BAD(},) | PDL_IF_BAD(},) | |||
', # what happens to signgam if $a() is bad? | ', # what happens to signgam if $a() is bad? | |||
); | ); | |||
} # elsif: cc =~ /\bgcc/i | } # elsif: cc =~ /\bgcc/i | |||
pp_def( | pp_def( | |||
'badmask', | ||||
Pars => 'a(); b(); [o]c();', | ||||
Inplace => [ 'a' ], | ||||
HandleBad => 1, | ||||
Code => | ||||
'$c() = ( isfinite((double) $a()) PDL_IF_BAD(&& $ISGOOD(a()),) ) ? $a() : | ||||
$b();', | ||||
CopyBadStatusCode => | ||||
'if ( a == c && $ISPDLSTATEBAD(a) ) | ||||
PDL->propagate_badflag( c, 0 ); /* propagate badflag if inplace AND | ||||
its changed */ | ||||
$SETPDLSTATEGOOD(c); /* always make sure the output is "good" * | ||||
/ | ||||
', | ||||
Doc => | ||||
'=for ref | ||||
Clears all C<infs> and C<nans> in C<$a> to the corresponding value in C<$b>. | ||||
badmask can be run with C<$x> inplace: | ||||
badmask($x->inplace,0); | ||||
$x->inplace->badmask(0); | ||||
', | ||||
BadDoc => | ||||
'If bad values are present, these are also cleared.', | ||||
); | ||||
pp_def( | ||||
'isfinite', | 'isfinite', | |||
Pars => 'a(); int [o]mask();', | Pars => 'a(); int [o]mask();', | |||
Inplace => 1, | Inplace => 1, | |||
HandleBad => 1, | HandleBad => 1, | |||
Code => | Code =>' | |||
'$mask() = isfinite((double) $a()) != 0 PDL_IF_BAD(&& $ISGOOD($a()),);', | broadcastloop %{ | |||
CopyBadStatusCode => | $mask() = isfinite((double) $a()) != 0 PDL_IF_BAD(&& $ISGOOD($a()),); | |||
'if ( a == mask && $ISPDLSTATEBAD(a) ) | %} | |||
PDL->propagate_badflag( mask, 0 ); /* propagate badflag if inplace A | $PDLSTATESETGOOD(mask); | |||
ND its changed */ | ||||
$SETPDLSTATEGOOD(mask); /* always make sure the output is "good | ||||
" */ | ||||
', | ', | |||
Doc => | Doc => | |||
'Sets C<$mask> true if C<$a> is not a C<NaN> or C<inf> (either positive or negat ive). Works inplace.', | 'Sets C<$mask> true if C<$a> is not a C<NaN> or C<inf> (either positive or negat ive). Works inplace.', | |||
BadDoc => | BadDoc => | |||
'Bad values are treated as C<NaN> or C<inf>.', | 'Bad values are treated as C<NaN> or C<inf>.', | |||
); | ); | |||
# Extra functions from cephes | # Extra functions from cephes | |||
pp_def( | pp_def( | |||
"erfi", | "erfi", | |||
End of changes. 2 change blocks. | ||||
38 lines changed or deleted | 5 lines changed or added |