?

Average Error: 99.1% → 99.1%
Time: 14.1s
Precision: binary64
Cost: 20288.00

?

\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
\[\left(\frac{1}{\frac{1}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} + 2\right) + -2 \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
(FPCore (v)
 :precision binary64
 (+
  (+ (/ 1.0 (/ 1.0 (acos (/ (fma v (* v -5.0) 1.0) (fma v v -1.0))))) 2.0)
  -2.0))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
double code(double v) {
	return ((1.0 / (1.0 / acos((fma(v, (v * -5.0), 1.0) / fma(v, v, -1.0))))) + 2.0) + -2.0;
}
function code(v)
	return acos(Float64(Float64(1.0 - Float64(5.0 * Float64(v * v))) / Float64(Float64(v * v) - 1.0)))
end
function code(v)
	return Float64(Float64(Float64(1.0 / Float64(1.0 / acos(Float64(fma(v, Float64(v * -5.0), 1.0) / fma(v, v, -1.0))))) + 2.0) + -2.0)
end
code[v_] := N[ArcCos[N[(N[(1.0 - N[(5.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(v * v), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
code[v_] := N[(N[(N[(1.0 / N[(1.0 / N[ArcCos[N[(N[(v * N[(v * -5.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision] + -2.0), $MachinePrecision]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\left(\frac{1}{\frac{1}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} + 2\right) + -2

Error?

Derivation?

  1. Initial program 99.1

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Applied egg-rr99.1

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{1 + \left(v \cdot v\right) \cdot -5}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)} \]
  3. Applied egg-rr99.1

    \[\leadsto \color{blue}{\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right) + 2\right) - 2} \]
  4. Applied egg-rr99.1

    \[\leadsto \left(\cos^{-1} \left(\frac{\color{blue}{v \cdot \left(v \cdot -5\right) + 1}}{\mathsf{fma}\left(v, v, -1\right)}\right) + 2\right) - 2 \]
  5. Applied egg-rr99.1

    \[\leadsto \left(\color{blue}{\frac{1}{\frac{1}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}} + 2\right) - 2 \]
  6. Final simplification99.1

    \[\leadsto \left(\frac{1}{\frac{1}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} + 2\right) + -2 \]

Alternatives

Alternative 1
Error99.1%
Cost13760.00
\[\left(2 + \cos^{-1} \left(\frac{1 + v \cdot \left(v \cdot -5\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right) + -2 \]
Alternative 2
Error98.7%
Cost7232.00
\[\cos^{-1} \left(\left(1 + v \cdot v\right) \cdot \left(-1 + 5 \cdot \left(v \cdot v\right)\right)\right) \]
Alternative 3
Error99.1%
Cost7232.00
\[\cos^{-1} \left(\frac{1 + -5 \cdot \left(v \cdot v\right)}{-1 + v \cdot v}\right) \]
Alternative 4
Error98.1%
Cost6848.00
\[\cos^{-1} \left(-1 + 5 \cdot \left(v \cdot v\right)\right) \]
Alternative 5
Error98.0%
Cost6464.00
\[\cos^{-1} -1 \]

Error

Reproduce?

herbie shell --seed 2023097 
(FPCore (v)
  :name "Falkner and Boettcher, Appendix B, 1"
  :precision binary64
  (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))