[Haskell-cafe] Numerics (was: Re: Trouble with asinh)

Bryan Richter b at chreekat.net
Sat Oct 23 06:06:35 UTC 2021


Hi David,

I have one suggestion for the haddocks. I made a solid effort to wade into
the explanation of branch cuts and negative zeros, but I never managed to
figure out why I should care. ;) In other words: tl;dr.

Would it be possible to write a pithy few words right at the beginning as
an introduction that motivates the topic? If, as you say, few other
languages take the subject into account, it's very likely that few
programmers take it into account either.

In general, as a math-conscious member of the community, I'm happy to see
this kind of work being accomplished, so thanks!

-Bryan

On Fri, 22 Oct 2021, 17.48 David James, <dj112358 at outlook.com> wrote:

> Hi all – I now have fixes for all the issues I’m aware of. However, it’s
> quite possible I’ve made a mistake somewhere (either in the new code or the
> testing), so if anyone would like to help review either please let me know.
>
>
>
> *Group 1 issues* (real numbers in Windows, where the defects are in
> mingw-w64: I’ve raised issue #20424
> <https://gitlab.haskell.org/ghc/ghc/-/issues/20424> for this. The fixes
> (commits 66ba5f32
> <https://github.com/mingw-w64/mingw-w64/commit/66ba5f3221c786de24f5fc4b9c0236b704c2d31d>
> and 021dffb8a
> <https://github.com/mingw-w64/mingw-w64/commit/021dffb8a482eb9d1b39569cd1ea42b87226fdf7>)
> have been made in mingw-w64 and are getting integrated into Haskell soon.
>
>
>
> *Group 2 issues* (complex numbers, where the defects are in Complex.hs).
> I’ve raised issue #20425
> <https://gitlab.haskell.org/ghc/ghc/-/issues/20425> for this and have the
> code fixes here
> <https://gitlab.haskell.org/davjam/ghc/-/blob/ComplexBranchCuts/libraries/base/Data/Complex.hs>.
> The new code changes many of the functions (I’ve given examples in the
> issue) and adds a few. I’ve also put the Haddock output here
> <https://davjam.github.io/HaskellNumericsTestsFixes/TrigDiags/Data-Complex.html>.
> (It now defines and gives an explanation of the branch cuts). I’ve also put
> some diagrams here
> <https://davjam.github.io/HaskellNumericsTestsFixes/TrigDiags/Curr.html>
> illustrating some of the problems.
>
>
>
> I’ve done about as much testing as I can think of, using the code here
> <https://github.com/davjam/HaskellNumericsTestsFixes/blob/main/ComplexTests.hs>.
> Ideally I’d bulk-test against a reliable independent source, but can’t find
> one. AFAICT WolframAlpha
> <https://www.wolframalpha.com/input/?i=sin%28-0.0%29>, Excel, gnumeric,
> CLISP don’t support negative zeros. Python <https://www.python.org/>
> seems to, but cmath has incorrect branch cuts (cmath.sqrt(-4-0j) gives 2j).
> Matlab
> <https://www.advanpix.com/2016/04/28/branch-cuts-and-signed-zeros-in-matlab/>
> also seems deficient in a number of areas. (Hmmm: maybe no one cares about
> these working correctly??)
>
>
>
> Sorry about the delay in sending this, David.
>
>
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20211023/f4333aef/attachment.html>


More information about the Haskell-Cafe mailing list