At line 90 of cbrtf64.rs
t = t * ((P0 + r * (P1 + r * P2)) + ((r * r) * r) * (P3 + r * P4));
I've noticed the expression has 7 mults and 4 adds. Perhaps there are performance rationale for duplications to powers of r that I'm unaware of, but I was wondering would following the Horner's polynomial method work just as well, now with only 5 mults ?
t *= r * (r * (r * (r * (P4) + P3) + P2) + P1) + P0 ;
It also improves readability by placing all copies of r on the left side, and all the co-efficients on the right, in big-endian order. Pairs of parentheses has shrunk from 6 to 4 (possibly 3, since grouping (P4) is superfluous).
my 2 cents
At line 90 of cbrtf64.rs
I've noticed the expression has 7 mults and 4 adds. Perhaps there are performance rationale for duplications to powers of
rthat I'm unaware of, but I was wondering would following the Horner's polynomial method work just as well, now with only 5 mults ?It also improves readability by placing all copies of
ron the left side, and all the co-efficients on the right, in big-endian order. Pairs of parentheses has shrunk from 6 to 4 (possibly 3, since grouping(P4)is superfluous).my 2 cents