Falkner and Boettcher, Appendix B, 1

Percentage Accurate: 99.1% → 99.1%
Time: 15.9s
Alternatives: 4
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \end{array} \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
real(8) function code(v)
    real(8), intent (in) :: v
    code = acos(((1.0d0 - (5.0d0 * (v * v))) / ((v * v) - 1.0d0)))
end function
public static double code(double v) {
	return Math.acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
def code(v):
	return math.acos(((1.0 - (5.0 * (v * v))) / ((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 tmp = code(v)
	tmp = acos(((1.0 - (5.0 * (v * v))) / ((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]
\begin{array}{l}

\\
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\end{array}

Sampling outcomes in binary64 precision:

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.

Accuracy vs Speed?

Herbie found 4 alternatives:

AlternativeAccuracySpeedup
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.

Initial Program: 99.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \end{array} \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
real(8) function code(v)
    real(8), intent (in) :: v
    code = acos(((1.0d0 - (5.0d0 * (v * v))) / ((v * v) - 1.0d0)))
end function
public static double code(double v) {
	return Math.acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
def code(v):
	return math.acos(((1.0 - (5.0 * (v * v))) / ((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 tmp = code(v)
	tmp = acos(((1.0 - (5.0 * (v * v))) / ((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]
\begin{array}{l}

\\
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\end{array}

Alternative 1: 99.1% accurate, 0.1× speedup?

\[\begin{array}{l} \\ e^{\log \left({\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right) \cdot 9} \end{array} \]
(FPCore (v)
 :precision binary64
 (exp
  (*
   (log
    (pow
     (cbrt (cbrt (cbrt (acos (/ (fma v (* v -5.0) 1.0) (fma v v -1.0))))))
     3.0))
   9.0)))
double code(double v) {
	return exp((log(pow(cbrt(cbrt(cbrt(acos((fma(v, (v * -5.0), 1.0) / fma(v, v, -1.0)))))), 3.0)) * 9.0));
}
function code(v)
	return exp(Float64(log((cbrt(cbrt(cbrt(acos(Float64(fma(v, Float64(v * -5.0), 1.0) / fma(v, v, -1.0)))))) ^ 3.0)) * 9.0))
end
code[v_] := N[Exp[N[(N[Log[N[Power[N[Power[N[Power[N[Power[N[ArcCos[N[(N[(v * N[(v * -5.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision] * 9.0), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\log \left({\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right) \cdot 9}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Step-by-step derivation
    1. add-log-exp99.5%

      \[\leadsto \color{blue}{\log \left(e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}\right)} \]
    2. add-cube-cbrt99.5%

      \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right) \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right)} \]
    3. log-prod99.5%

      \[\leadsto \color{blue}{\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right)} \]
  3. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
  4. Step-by-step derivation
    1. log-prod99.5%

      \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)\right)} + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    2. count-299.5%

      \[\leadsto \color{blue}{2 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    3. distribute-lft1-in99.5%

      \[\leadsto \color{blue}{\left(2 + 1\right) \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
    4. metadata-eval99.5%

      \[\leadsto \color{blue}{3} \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    5. fma-udef99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{\left(v \cdot v\right) \cdot -5 + 1}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    6. metadata-eval99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(v \cdot v\right) \cdot \color{blue}{\left(-5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    7. distribute-rgt-neg-in99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{\left(-\left(v \cdot v\right) \cdot 5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    8. *-commutative99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(-\color{blue}{5 \cdot \left(v \cdot v\right)}\right) + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    9. unpow299.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(-5 \cdot \color{blue}{{v}^{2}}\right) + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    10. +-commutative99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{1 + \left(-5 \cdot {v}^{2}\right)}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    11. sub-neg99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{1 - 5 \cdot {v}^{2}}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    12. metadata-eval99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot {v}^{2}}{\mathsf{fma}\left(v, v, \color{blue}{-1}\right)}\right)}}\right) \]
    13. fma-neg99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot {v}^{2}}{\color{blue}{v \cdot v - 1}}\right)}}\right) \]
  5. Simplified99.5%

    \[\leadsto \color{blue}{3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
  6. Step-by-step derivation
    1. add-cube-cbrt95.6%

      \[\leadsto 3 \cdot \log \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}} \cdot \sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)} \]
    2. pow396.0%

      \[\leadsto 3 \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \]
  7. Applied egg-rr96.0%

    \[\leadsto 3 \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \]
  8. Step-by-step derivation
    1. add-log-exp96.0%

      \[\leadsto \color{blue}{\log \left(e^{3 \cdot \log \left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)}\right)} \]
    2. *-commutative96.0%

      \[\leadsto \log \left(e^{\color{blue}{\log \left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right) \cdot 3}}\right) \]
    3. rem-cube-cbrt99.5%

      \[\leadsto \log \left(e^{\log \color{blue}{\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \cdot 3}\right) \]
    4. exp-to-pow99.5%

      \[\leadsto \log \color{blue}{\left({\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)}^{3}\right)} \]
    5. pow399.5%

      \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
    6. add-cube-cbrt99.5%

      \[\leadsto \log \color{blue}{\left(e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)} \]
    7. add-log-exp99.5%

      \[\leadsto \color{blue}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)} \]
    8. add-cube-cbrt97.1%

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

    \[\leadsto \color{blue}{e^{\log \left(\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \cdot 9}} \]
  10. Step-by-step derivation
    1. add-cube-cbrt99.5%

      \[\leadsto e^{\log \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)} \cdot 9} \]
    2. pow399.5%

      \[\leadsto e^{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \cdot 9} \]
  11. Applied egg-rr99.5%

    \[\leadsto e^{\log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \cdot 9} \]
  12. Final simplification99.5%

    \[\leadsto e^{\log \left({\left(\sqrt[3]{\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right) \cdot 9} \]

Alternative 2: 99.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ e^{9 \cdot \log \left(\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \end{array} \]
(FPCore (v)
 :precision binary64
 (exp
  (*
   9.0
   (log (cbrt (cbrt (acos (/ (fma v (* v -5.0) 1.0) (fma v v -1.0)))))))))
double code(double v) {
	return exp((9.0 * log(cbrt(cbrt(acos((fma(v, (v * -5.0), 1.0) / fma(v, v, -1.0))))))));
}
function code(v)
	return exp(Float64(9.0 * log(cbrt(cbrt(acos(Float64(fma(v, Float64(v * -5.0), 1.0) / fma(v, v, -1.0))))))))
end
code[v_] := N[Exp[N[(9.0 * N[Log[N[Power[N[Power[N[ArcCos[N[(N[(v * N[(v * -5.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{9 \cdot \log \left(\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)}
\end{array}
Derivation
  1. Initial program 99.5%

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Step-by-step derivation
    1. add-log-exp99.5%

      \[\leadsto \color{blue}{\log \left(e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}\right)} \]
    2. add-cube-cbrt99.5%

      \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right) \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right)} \]
    3. log-prod99.5%

      \[\leadsto \color{blue}{\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}}\right)} \]
  3. Applied egg-rr99.5%

    \[\leadsto \color{blue}{\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
  4. Step-by-step derivation
    1. log-prod99.5%

      \[\leadsto \color{blue}{\left(\log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)\right)} + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    2. count-299.5%

      \[\leadsto \color{blue}{2 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} + \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    3. distribute-lft1-in99.5%

      \[\leadsto \color{blue}{\left(2 + 1\right) \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
    4. metadata-eval99.5%

      \[\leadsto \color{blue}{3} \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    5. fma-udef99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{\left(v \cdot v\right) \cdot -5 + 1}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    6. metadata-eval99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(v \cdot v\right) \cdot \color{blue}{\left(-5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    7. distribute-rgt-neg-in99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{\left(-\left(v \cdot v\right) \cdot 5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    8. *-commutative99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(-\color{blue}{5 \cdot \left(v \cdot v\right)}\right) + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    9. unpow299.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\left(-5 \cdot \color{blue}{{v}^{2}}\right) + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    10. +-commutative99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{1 + \left(-5 \cdot {v}^{2}\right)}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    11. sub-neg99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\color{blue}{1 - 5 \cdot {v}^{2}}}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \]
    12. metadata-eval99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot {v}^{2}}{\mathsf{fma}\left(v, v, \color{blue}{-1}\right)}\right)}}\right) \]
    13. fma-neg99.5%

      \[\leadsto 3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{1 - 5 \cdot {v}^{2}}{\color{blue}{v \cdot v - 1}}\right)}}\right) \]
  5. Simplified99.5%

    \[\leadsto \color{blue}{3 \cdot \log \left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
  6. Step-by-step derivation
    1. add-cube-cbrt95.6%

      \[\leadsto 3 \cdot \log \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}} \cdot \sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right) \cdot \sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)} \]
    2. pow396.0%

      \[\leadsto 3 \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \]
  7. Applied egg-rr96.0%

    \[\leadsto 3 \cdot \log \color{blue}{\left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)} \]
  8. Step-by-step derivation
    1. add-log-exp96.0%

      \[\leadsto \color{blue}{\log \left(e^{3 \cdot \log \left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right)}\right)} \]
    2. *-commutative96.0%

      \[\leadsto \log \left(e^{\color{blue}{\log \left({\left(\sqrt[3]{\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}}\right)}^{3}\right) \cdot 3}}\right) \]
    3. rem-cube-cbrt99.5%

      \[\leadsto \log \left(e^{\log \color{blue}{\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \cdot 3}\right) \]
    4. exp-to-pow99.5%

      \[\leadsto \log \color{blue}{\left({\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)}^{3}\right)} \]
    5. pow399.5%

      \[\leadsto \log \color{blue}{\left(\left(\sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \cdot \sqrt[3]{e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]
    6. add-cube-cbrt99.5%

      \[\leadsto \log \color{blue}{\left(e^{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)} \]
    7. add-log-exp99.5%

      \[\leadsto \color{blue}{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)} \]
    8. add-cube-cbrt97.1%

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

    \[\leadsto \color{blue}{e^{\log \left(\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right) \cdot 9}} \]
  10. Final simplification99.5%

    \[\leadsto e^{9 \cdot \log \left(\sqrt[3]{\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)} \]

Alternative 3: 99.1% accurate, 0.4× speedup?

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

\\
3 \cdot \left(\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right) \cdot 0.3333333333333333\right)
\end{array}
Derivation
  1. Initial program 99.5%

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Step-by-step derivation
    1. add-cube-cbrt97.1%

      \[\leadsto \color{blue}{\left(\sqrt[3]{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)} \cdot \sqrt[3]{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}\right) \cdot \sqrt[3]{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}} \]
    2. pow398.0%

      \[\leadsto \color{blue}{{\left(\sqrt[3]{\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)}\right)}^{3}} \]
    3. sub-neg98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\color{blue}{1 + \left(-5 \cdot \left(v \cdot v\right)\right)}}{v \cdot v - 1}\right)}\right)}^{3} \]
    4. +-commutative98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\color{blue}{\left(-5 \cdot \left(v \cdot v\right)\right) + 1}}{v \cdot v - 1}\right)}\right)}^{3} \]
    5. *-commutative98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\left(-\color{blue}{\left(v \cdot v\right) \cdot 5}\right) + 1}{v \cdot v - 1}\right)}\right)}^{3} \]
    6. distribute-rgt-neg-in98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\color{blue}{\left(v \cdot v\right) \cdot \left(-5\right)} + 1}{v \cdot v - 1}\right)}\right)}^{3} \]
    7. fma-def98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\color{blue}{\mathsf{fma}\left(v \cdot v, -5, 1\right)}}{v \cdot v - 1}\right)}\right)}^{3} \]
    8. metadata-eval98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, \color{blue}{-5}, 1\right)}{v \cdot v - 1}\right)}\right)}^{3} \]
    9. fma-neg98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\color{blue}{\mathsf{fma}\left(v, v, -1\right)}}\right)}\right)}^{3} \]
    10. metadata-eval98.0%

      \[\leadsto {\left(\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, \color{blue}{-1}\right)}\right)}\right)}^{3} \]
  3. Applied egg-rr98.0%

    \[\leadsto \color{blue}{{\left(\sqrt[3]{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{3}} \]
  4. Step-by-step derivation
    1. pow1/398.0%

      \[\leadsto {\color{blue}{\left({\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}^{0.3333333333333333}\right)}}^{3} \]
    2. add-sqr-sqrt98.0%

      \[\leadsto {\left({\color{blue}{\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)} \cdot \sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}}^{0.3333333333333333}\right)}^{3} \]
    3. unpow-prod-down97.1%

      \[\leadsto {\color{blue}{\left({\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}}^{3} \]
    4. fma-udef97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{\left(v \cdot v\right) \cdot -5 + 1}}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    5. associate-*r*97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{v \cdot \left(v \cdot -5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    6. fma-udef97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{\mathsf{fma}\left(v, v \cdot -5, 1\right)}}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v \cdot v, -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    7. fma-udef97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{\left(v \cdot v\right) \cdot -5 + 1}}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    8. associate-*r*97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{v \cdot \left(v \cdot -5\right)} + 1}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    9. fma-udef97.1%

      \[\leadsto {\left({\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\color{blue}{\mathsf{fma}\left(v, v \cdot -5, 1\right)}}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
  5. Applied egg-rr97.1%

    \[\leadsto {\color{blue}{\left({\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}}^{3} \]
  6. Step-by-step derivation
    1. unpow1/398.0%

      \[\leadsto {\left(\color{blue}{\sqrt[3]{\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}} \cdot {\left(\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}\right)}^{0.3333333333333333}\right)}^{3} \]
    2. unpow1/394.7%

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

    \[\leadsto {\color{blue}{\left(\sqrt[3]{\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}} \cdot \sqrt[3]{\sqrt{\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)}}\right)}}^{3} \]
  8. Step-by-step derivation
    1. unpow395.0%

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

    \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right) \cdot 3} \]
  10. Final simplification99.5%

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

Alternative 4: 99.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{-1 + v \cdot v}\right) \end{array} \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (+ -1.0 (* v v)))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / (-1.0 + (v * v))));
}
real(8) function code(v)
    real(8), intent (in) :: v
    code = acos(((1.0d0 - (5.0d0 * (v * v))) / ((-1.0d0) + (v * v))))
end function
public static double code(double v) {
	return Math.acos(((1.0 - (5.0 * (v * v))) / (-1.0 + (v * v))));
}
def code(v):
	return math.acos(((1.0 - (5.0 * (v * v))) / (-1.0 + (v * v))))
function code(v)
	return acos(Float64(Float64(1.0 - Float64(5.0 * Float64(v * v))) / Float64(-1.0 + Float64(v * v))))
end
function tmp = code(v)
	tmp = acos(((1.0 - (5.0 * (v * v))) / (-1.0 + (v * v))));
end
code[v_] := N[ArcCos[N[(N[(1.0 - N[(5.0 * N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-1.0 + N[(v * v), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{-1 + v \cdot v}\right)
\end{array}
Derivation
  1. Initial program 99.5%

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Final simplification99.5%

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

Reproduce

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