Proposal: Add "fma" to the RealFloat class

Edward Kmett ekmett at
Mon May 4 14:20:46 UTC 2015

Quite a bit actually.

Consider something like:

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

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.


On Mon, May 4, 2015 at 4:14 AM, Joachim Breitner <mail at>

> 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
>   Jabber: nomeata at  • GPG-Key: 0xF0FBF51F
>   Debian Developer: nomeata at
> _______________________________________________
> Libraries mailing list
> Libraries at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Libraries mailing list