Average Error: 0.5 → 0.5
Time: 11.3s
Precision: binary64
Cost: 13696
\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
\[\pi - \cos^{-1} \left(\frac{-5 \cdot \left(v \cdot v\right) + 1}{1 - v \cdot v}\right) \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
(FPCore (v)
 :precision binary64
 (- PI (acos (/ (+ (* -5.0 (* v v)) 1.0) (- 1.0 (* v v))))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
double code(double v) {
	return ((double) M_PI) - acos((((-5.0 * (v * v)) + 1.0) / (1.0 - (v * v))));
}
public static double code(double v) {
	return Math.acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
public static double code(double v) {
	return Math.PI - Math.acos((((-5.0 * (v * v)) + 1.0) / (1.0 - (v * v))));
}
def code(v):
	return math.acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)))
def code(v):
	return math.pi - math.acos((((-5.0 * (v * v)) + 1.0) / (1.0 - (v * v))))
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(pi - acos(Float64(Float64(Float64(-5.0 * Float64(v * v)) + 1.0) / Float64(1.0 - Float64(v * v)))))
end
function tmp = code(v)
	tmp = acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
end
function tmp = code(v)
	tmp = pi - acos((((-5.0 * (v * v)) + 1.0) / (1.0 - (v * v))));
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[(Pi - N[ArcCos[N[(N[(N[(-5.0 * N[(v * v), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(1.0 - N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\pi - \cos^{-1} \left(\frac{-5 \cdot \left(v \cdot v\right) + 1}{1 - v \cdot v}\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.5

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

    \[\leadsto \color{blue}{\pi - \cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{-\mathsf{fma}\left(v, v, -1\right)}\right)} \]
  3. Simplified0.5

    \[\leadsto \color{blue}{\pi - \cos^{-1} \left(\frac{\mathsf{fma}\left(-5, v \cdot v, 1\right)}{1 - v \cdot v}\right)} \]
    Proof
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 -5 (*.f64 v v) 1) (-.f64 1 (*.f64 v v))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (Rewrite=> fma-udef_binary64 (+.f64 (*.f64 -5 (*.f64 v v)) 1)) (-.f64 1 (*.f64 v v))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (+.f64 (Rewrite<= *-commutative_binary64 (*.f64 (*.f64 v v) -5)) 1) (-.f64 1 (*.f64 v v))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (Rewrite<= fma-udef_binary64 (fma.f64 (*.f64 v v) -5 1)) (-.f64 1 (*.f64 v v))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 (*.f64 v v) -5 1) (-.f64 (Rewrite<= metadata-eval (-.f64 0 -1)) (*.f64 v v))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 (*.f64 v v) -5 1) (Rewrite<= associate--r+_binary64 (-.f64 0 (+.f64 -1 (*.f64 v v))))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 (*.f64 v v) -5 1) (-.f64 0 (Rewrite<= +-commutative_binary64 (+.f64 (*.f64 v v) -1)))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 (*.f64 v v) -5 1) (-.f64 0 (Rewrite<= fma-udef_binary64 (fma.f64 v v -1)))))): 0 points increase in error, 0 points decrease in error
    (-.f64 (PI.f64) (acos.f64 (/.f64 (fma.f64 (*.f64 v v) -5 1) (Rewrite<= neg-sub0_binary64 (neg.f64 (fma.f64 v v -1)))))): 0 points increase in error, 0 points decrease in error
  4. Applied egg-rr0.5

    \[\leadsto \pi - \cos^{-1} \left(\frac{\color{blue}{-5 \cdot \left(v \cdot v\right) + 1}}{1 - v \cdot v}\right) \]
  5. Final simplification0.5

    \[\leadsto \pi - \cos^{-1} \left(\frac{-5 \cdot \left(v \cdot v\right) + 1}{1 - v \cdot v}\right) \]

Alternatives

Alternative 1
Error0.5
Cost7232
\[\cos^{-1} \left(\frac{-5 \cdot \left(v \cdot v\right) + 1}{v \cdot v + -1}\right) \]
Alternative 2
Error1.3
Cost6464
\[\cos^{-1} -1 \]

Error

Reproduce

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