[PATCH v3 4/9] Add new pow implementation
Joseph Myers
joseph@codesourcery.com
Mon Jul 2 21:58:00 GMT 2018
On Fri, 29 Jun 2018, Szabolcs Nagy wrote:
> +#if POW_LOG_POLY_ORDER == 8
> + p = ar3
> + * (A[1] + r * A[2] + ar2 * (A[3] + r * A[4] + ar2 * (A[5] + r * A[6])));
Should have parentheses here around the RHS of the assignment to ensure
the indentation is preserved (see the GNU Coding Standards).
> +/* Handle inputs that may overflow or underflow when computing the result
> + that is scale*(1+tmp), the exponent bits of scale might have overflown
> + into the sign bit so that needs correction before sbits is used as a
> + double, ki is only used to determine the sign of the exponent. */
> +static inline double
> +specialcase (double_t tmp, uint64_t sbits, uint64_t ki)
Same comment applies as for exp about properly defining the semantics of
the function arguments and results.
> + /* Without fma the worst case error is 0.25/N ulp larger. */
> + /* Worst case error is less than 0.5+1.11/N+(abs poly error * 2^53) ulp. */
> +#if EXP_POLY_ORDER == 4
> + tmp = tail + r + r2 * C2 + r * r2 * (C3 + r * C4);
> +#elif EXP_POLY_ORDER == 5
> + tmp = tail + r + r2 * (C2 + r * C3) + r2 * r2 * (C4 + r * C5);
> +#elif EXP_POLY_ORDER == 6
> + tmp = tail + r + r2 * (0.5 + r * C3) + r2 * r2 * (C4 + r * C5 + r2 * C6);
Same comment as before about not having such variants without a clear
explanation of why different architectures should use different choices.
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Libc-alpha
mailing list