Proposal: Add "fma" to the RealFloat class
Edward Kmett
ekmett at gmail.com
Mon May 4 14:20:46 UTC 2015
Quite a bit actually.
Consider something like:
http://hackage.haskell.org/package/ad-4.2.1.1/docs/src/Numeric-AD-Rank1-Newton.html#gradientDescent
The step function in there could be trivially adapted to using fused
multiplyAdd and precision would just improve. If such a member _were_ in
Num, I'd use it in a heartbeat there. If it were in an extra class? I'd
have to make a second copy of the function to even try to see the precision
win.
Most of my numeric code is generic in some fashion, working over vector
spaces or simpler number types just as easily.
As this proposal has been withdrawn, the point is more or less moot for now.
-Edward
On Mon, May 4, 2015 at 4:14 AM, Joachim Breitner <mail at joachim-breitner.de>
wrote:
> Hi,
>
>
> Am Sonntag, den 03.05.2015, 14:11 -0700 schrieb Levent Erkok:
>
> > Based on this analysis, I'm withdrawing the original proposal. I think
> > fma and other floating-point arithmetic operations are very important
> > to support properly, but it should not be done by tacking them on to
> > Num or RealFloat; but rather in a new class that also considers
> > rounding-mode properly.
> >
> does it really have to be a class? How much genuinely polymorphic code
> is there out there that yet requires this precise handling of precision?
>
> Have you considered adding it as monomorphic functions fmaDouble,
> fmaFloat etc. on hackage, using FFI? Then those who need these functions
> can start to use them.
>
> Furthermore you can start getting the necessary primops supported in
> GHC, and have your library transparently use them when available.
>
> And only then, when we have the implementation in place and actual
> users, we can evaluate whether we need an abstract class for this.
>
>
> Greetings,
> Joachim
>
>
> --
> Joachim “nomeata” Breitner
> mail at joachim-breitner.de • http://www.joachim-breitner.de/
> Jabber: nomeata at joachim-breitner.de • GPG-Key: 0xF0FBF51F
> Debian Developer: nomeata at debian.org
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150504/6ade08fe/attachment.html>
More information about the Libraries
mailing list