Average Error: 0.6 → 0.9
Time: 4.9s
Precision: 64
\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\mathsf{fma}\left(4, \mathsf{fma}\left(v, v, {v}^{4}\right), -1\right)\right)\right)\right)\]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\mathsf{fma}\left(4, \mathsf{fma}\left(v, v, {v}^{4}\right), -1\right)\right)\right)\right)
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
double code(double v) {
	return expm1(log1p(acos(fma(4.0, fma(v, v, pow(v, 4.0)), -1.0))));
}

Error

Bits error versus v

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.6

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\]
  2. Using strategy rm
  3. Applied expm1-log1p-u0.6

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)\right)\right)}\]
  4. Taylor expanded around 0 0.9

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \color{blue}{\left(\left(4 \cdot {v}^{2} + 4 \cdot {v}^{4}\right) - 1\right)}\right)\right)\]
  5. Simplified0.9

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \color{blue}{\left(\mathsf{fma}\left(4, \mathsf{fma}\left(v, v, {v}^{4}\right), -1\right)\right)}\right)\right)\]
  6. Final simplification0.9

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\mathsf{fma}\left(4, \mathsf{fma}\left(v, v, {v}^{4}\right), -1\right)\right)\right)\right)\]

Reproduce

herbie shell --seed 2020049 +o rules:numerics
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 1"
  :precision binary64
  (acos (/ (- 1 (* 5 (* v v))) (- (* v v) 1))))