Proposal: Add "fma" to the RealFloat class

Levent Erkok erkokl at gmail.com
Mon May 4 17:49:52 UTC 2015


Artyom: That's precisely the point. The true IEEE754 variants where
precision does matter should be part of a different class. What Edward and
Yitz want is an "optimized" multiply-add where the semantics is the same
but one that goes faster.

On Mon, May 4, 2015 at 10:40 AM, Artyom <yom at artyom.me> wrote:

>  On 05/04/2015 08:36 PM, Levent Erkok wrote:
>
> In particular, the compiler should be free to substitute "a*b+c" with
> "mulAccum a b c".
>
> But isn't it unacceptable in some cases? For instance, in this case (taken
> from Wikipedia):
>
> If *x*2 − *y*2 is evaluated as ((*x*×*x*) − *y*×*y*) using fused
> multiply–add, then the result may be negative even when *x* = *y* due to
> the first multiplication discarding low significance bits. This could then
> lead to an error if, for instance, the square root of the result is then
> evaluated.
>
>
>
> _______________________________________________
> 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/2417b8e0/attachment.html>


More information about the Libraries mailing list