On 09/27/2016 09:33 AM, G 3 wrote: >>> void fmadds(float *frD, float frA, float frC, float frB) >>> { >>> *frD = frA * frC + frB; >>> }
> > It sounds like I should change my argument types to double. Insufficient. The whole reason that fmadds exists is that there are provably cases where two operations that both round are GUARANTEED to get the wrong answer when compared to a single operation, regardless of the precisions involved. Widening from float to double does NOT eliminate the double-rounding problem. > > I still want to try implementing this function. I'm thinking rewriting the > helper_fmadd() function in target-ppc/fpu_helper.c. Does that > sound correct? I seriously doubt you would be able to write a correct implementation, if you aren't even aware of the double-rounding reasons why fmadds was added to the IEEE floating point specification in the first place. Your idea that you would be able to speed things up is probably a premature optimization, given that you have no realistic clue how hard it is to CORRECTLY implement fused-multiply-add. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature