Average Error: 0.5 → 0.5
Time: 7.7s
Precision: binary64
\[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
\[\begin{array}{l} t_0 := \mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\\ \mathsf{expm1}\left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(t_0\right)\right)} \cdot \sqrt{t_0}\right) \end{array} \]
(FPCore (v)
 :precision binary64
 (acos (/ (- 1.0 (* 5.0 (* v v))) (- (* v v) 1.0))))
(FPCore (v)
 :precision binary64
 (let* ((t_0 (log1p (acos (/ (fma v (* v -5.0) 1.0) (fma v v -1.0))))))
   (expm1 (* (sqrt (expm1 (log1p t_0))) (sqrt t_0)))))
double code(double v) {
	return acos(((1.0 - (5.0 * (v * v))) / ((v * v) - 1.0)));
}
double code(double v) {
	double t_0 = log1p(acos((fma(v, (v * -5.0), 1.0) / fma(v, v, -1.0))));
	return expm1((sqrt(expm1(log1p(t_0))) * sqrt(t_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)
	t_0 = log1p(acos(Float64(fma(v, Float64(v * -5.0), 1.0) / fma(v, v, -1.0))))
	return expm1(Float64(sqrt(expm1(log1p(t_0))) * sqrt(t_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_] := Block[{t$95$0 = N[Log[1 + N[ArcCos[N[(N[(v * N[(v * -5.0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(v * v + -1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]}, N[(Exp[N[(N[Sqrt[N[(Exp[N[Log[1 + t$95$0], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]]
\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right)
\begin{array}{l}
t_0 := \mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\\
\mathsf{expm1}\left(\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(t_0\right)\right)} \cdot \sqrt{t_0}\right)
\end{array}

Error

Bits error versus v

Derivation

  1. Initial program 0.5

    \[\cos^{-1} \left(\frac{1 - 5 \cdot \left(v \cdot v\right)}{v \cdot v - 1}\right) \]
  2. Simplified0.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)} \]
  3. Applied expm1-log1p-u_binary640.5

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\cos^{-1} \left(\frac{\mathsf{fma}\left(v, v \cdot -5, 1\right)}{\mathsf{fma}\left(v, v, -1\right)}\right)\right)\right)} \]
  4. Applied add-sqr-sqrt_binary640.5

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

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

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

Reproduce

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