Proposal: Add "fma" to the RealFloat class

Artyom yom at artyom.me
Mon May 4 17:58:21 UTC 2015


On 05/04/2015 08:49 PM, Levent Erkok wrote:
> 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.
No, it looks to me that Edward wants to have a more precise operation in 
Num:
> I'd have to make a second copy of the function to even try to see the 
> precision win.
Unless I'm wrong, you can't have the following things simultaneously:

 1. the compiler is free to substitute /a+b*c/ with /mulAdd a b c/
 2. /mulAdd a b c/ is implemented as /fma/ for Doubles (and is more precise)
 3. Num operations for Double (addition and multiplication) always
    conform to IEEE754

> The true IEEE754 variants where precision does matter should be part 
> of a different class.
So, does it mean that you're fine with not having point #3 because 
people who need it would be able to use a separate class for IEEE754 floats?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20150504/a93029fb/attachment.html>


More information about the Libraries mailing list