[Haskell-cafe] Numerics (was: Re: Trouble with asinh)
a.pelenitsyn at gmail.com
Sat Sep 18 18:02:11 UTC 2021
These are really good points. They seem worth submitting to the GHC issue
tracker. This would be a first step on the way to improve the current (not
ideal, as you say) state.
On Fri, Sep 17, 2021 at 5:06 PM Barak A. Pearlmutter <barak at pearlmutter.net>
> I suspect that most implementations of Common Lisp just call the C
> standard library catan(3) etc, which are well tuned.
> $ clisp
> Welcome to GNU CLISP 2.49.92 (2018-02-18) <http://clisp.org/>
> > (atan #c(0 1d-40))
> #C(0 1.0d-40)
> In this particular case, the problem is that the Haskell Data.Complex
> code has its own implementation of atan, which uses a log(1 + x) in
> calculating the imaginary part. A foreign function call to the
> appropriate libm routine would robustly address this, but that would
> be difficult because it's trying to be generic over RealFloat a =>
> Complex a, instead of special casing Complex Float / Complex Double.
> Anyway, the Standard Prelude code for this is naïve: it should call
> log1p, at the very least—which it actually goes to the trouble of
> defining correctly, but not exporting.
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe