On Sat Mar 14 12:27:42 2020, pjacklam wrote:
Show quoted text> The following should return -92.7965509003218 as a Perl scalar:
>
> $z = asinh(-1e+40);
>
> The following should return -92.7965509003218 as a Math::Complex object:
>
> $x = Math::Complex->new(-1e+40); $z = asinh($x);
>
> But both cases return the complex value
>
> -92.7965509003218 + 3.14159265358979i
I think this could be fixed by modifying the termination of the asinh() implementation to return only the real component if ref($z) was untrue.
That is, instead of terminating the asinh() sub with simply:
return &log($t);
terminate with something like (untested):
my $ret = &log($t);
return (@{$ret->cartesian})[0] unless ref($z);
return $ret;
Cheers,
Rob