Falkner and Boettcher, Appendix B, 1

?

Percentage Accurate: 99.1% → 99.1%
Time: 14.8s
Precision: binary64
Cost: 19968

?

\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
\[\cos^{-1} \left(\frac{1 - \sqrt[3]{{v}^{6} \cdot 125}}{v \cdot v + -1}\right) \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (cbrt (* (pow v 6.0) 125.0))) (+ (* v v) -1.0))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
double code(double v) {
	return acos(((1.0 - cbrt((pow(v, 6.0) * 125.0))) / ((v * v) + -1.0)));
}
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.acos(((1.0 - Math.cbrt((Math.pow(v, 6.0) * 125.0))) / ((v * v) + -1.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 acos(Float64(Float64(1.0 - cbrt(Float64((v ^ 6.0) * 125.0))) / Float64(Float64(v * v) + -1.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[ArcCos[N[(N[(1.0 - N[Power[N[(N[Power[v, 6.0], $MachinePrecision] * 125.0), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] / N[(N[(v * v), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\cos^{-1} \left(\frac{1 - \sqrt[3]{{v}^{6} \cdot 125}}{v \cdot v + -1}\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Herbie found 3 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 99.4%

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

    \[\leadsto \cos^{-1} \left(\frac{1 - \color{blue}{{\left(125 \cdot {v}^{6}\right)}^{0.3333333333333333}}}{v \cdot v - 1}\right) \]
    Step-by-step derivation

    [Start]99.4%

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

    add-cbrt-cube [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - \color{blue}{\sqrt[3]{\left(\left(5 \cdot \left(v \cdot v\right)\right) \cdot \left(5 \cdot \left(v \cdot v\right)\right)\right) \cdot \left(5 \cdot \left(v \cdot v\right)\right)}}}{v \cdot v - 1}\right) \]

    pow1/3 [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - \color{blue}{{\left(\left(\left(5 \cdot \left(v \cdot v\right)\right) \cdot \left(5 \cdot \left(v \cdot v\right)\right)\right) \cdot \left(5 \cdot \left(v \cdot v\right)\right)\right)}^{0.3333333333333333}}}{v \cdot v - 1}\right) \]

    pow3 [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\color{blue}{\left({\left(5 \cdot \left(v \cdot v\right)\right)}^{3}\right)}}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    unpow-prod-down [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\color{blue}{\left({5}^{3} \cdot {\left(v \cdot v\right)}^{3}\right)}}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    metadata-eval [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\left(\color{blue}{125} \cdot {\left(v \cdot v\right)}^{3}\right)}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    pow2 [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\left(125 \cdot {\color{blue}{\left({v}^{2}\right)}}^{3}\right)}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    pow-pow [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\left(125 \cdot \color{blue}{{v}^{\left(2 \cdot 3\right)}}\right)}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    metadata-eval [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\left(125 \cdot {v}^{\color{blue}{6}}\right)}^{0.3333333333333333}}{v \cdot v - 1}\right) \]
  3. Simplified99.4%

    \[\leadsto \cos^{-1} \left(\frac{1 - \color{blue}{\sqrt[3]{{v}^{6} \cdot 125}}}{v \cdot v - 1}\right) \]
    Step-by-step derivation

    [Start]99.4%

    \[ \cos^{-1} \left(\frac{1 - {\left(125 \cdot {v}^{6}\right)}^{0.3333333333333333}}{v \cdot v - 1}\right) \]

    unpow1/3 [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - \color{blue}{\sqrt[3]{125 \cdot {v}^{6}}}}{v \cdot v - 1}\right) \]

    *-commutative [=>]99.4%

    \[ \cos^{-1} \left(\frac{1 - \sqrt[3]{\color{blue}{{v}^{6} \cdot 125}}}{v \cdot v - 1}\right) \]
  4. Final simplification99.4%

    \[\leadsto \cos^{-1} \left(\frac{1 - \sqrt[3]{{v}^{6} \cdot 125}}{v \cdot v + -1}\right) \]

Alternatives

Alternative 1
Accuracy99.1%
Cost19968
\[\cos^{-1} \left(\frac{1 - \sqrt[3]{{v}^{6} \cdot 125}}{v \cdot v + -1}\right) \]
Alternative 2
Accuracy99.1%
Cost7232
\[\cos^{-1} \left(\frac{1 - \left(v \cdot v\right) \cdot 5}{v \cdot v + -1}\right) \]
Alternative 3
Accuracy98.0%
Cost6464
\[\cos^{-1} -1 \]

Reproduce?

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