Skip to content

Use proper double word division algorithm for pow<double>. Gives 11-15% speedup.

Reference issue

What does this implement/fix?

Fix TODO in accurate_log2<double> used by pow<double>. This change replaces the division via an approximate reciprocal with Algorithm 15 from:

"Tight and rigourous error bounds for basic building blocks of double-word arithmetic", Joldes, Muller, & Popescu, 2017. https://hal.archives-ouvertes.fr/hal-01351529

This speeds up pow<double> by 11-15%. Benchmark measurements: $2390173

Comparison against MPFR shows no change in accuracy. The algorithm still return faithfully rounded results when the result is normal.

Thanks to David Majnemer (majnemer@google.com) for pointing me to the paper.

Additional information

Edited by Rasmus Munk Larsen

Merge request reports

Loading