| Alternative 1 | |
|---|---|
| Error | 14.7 |
| Cost | 20352 |
\[\frac{0.5 - \sqrt{\frac{0.25}{1 + x \cdot x}}}{1 + \sqrt{0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}}}
\]
(FPCore (x) :precision binary64 (- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))
(FPCore (x)
:precision binary64
(let* ((t_0 (+ 0.5 (/ 0.5 (hypot 1.0 x)))))
(/
(/
(*
(cbrt (pow (+ 0.25 (/ -0.25 (fma x x 1.0))) 2.0))
(cbrt (+ 0.5 (/ -0.5 (hypot 1.0 x)))))
(pow (cbrt t_0) 2.0))
(+ 1.0 (sqrt t_0)))))double code(double x) {
return 1.0 - sqrt((0.5 * (1.0 + (1.0 / hypot(1.0, x)))));
}
double code(double x) {
double t_0 = 0.5 + (0.5 / hypot(1.0, x));
return ((cbrt(pow((0.25 + (-0.25 / fma(x, x, 1.0))), 2.0)) * cbrt((0.5 + (-0.5 / hypot(1.0, x))))) / pow(cbrt(t_0), 2.0)) / (1.0 + sqrt(t_0));
}
function code(x) return Float64(1.0 - sqrt(Float64(0.5 * Float64(1.0 + Float64(1.0 / hypot(1.0, x)))))) end
function code(x) t_0 = Float64(0.5 + Float64(0.5 / hypot(1.0, x))) return Float64(Float64(Float64(cbrt((Float64(0.25 + Float64(-0.25 / fma(x, x, 1.0))) ^ 2.0)) * cbrt(Float64(0.5 + Float64(-0.5 / hypot(1.0, x))))) / (cbrt(t_0) ^ 2.0)) / Float64(1.0 + sqrt(t_0))) end
code[x_] := N[(1.0 - N[Sqrt[N[(0.5 * N[(1.0 + N[(1.0 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[x_] := Block[{t$95$0 = N[(0.5 + N[(0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(N[Power[N[Power[N[(0.25 + N[(-0.25 / N[(x * x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision], 1/3], $MachinePrecision] * N[Power[N[(0.5 + N[(-0.5 / N[Sqrt[1.0 ^ 2 + x ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] / N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
1 - \sqrt{0.5 \cdot \left(1 + \frac{1}{\mathsf{hypot}\left(1, x\right)}\right)}
\begin{array}{l}
t_0 := 0.5 + \frac{0.5}{\mathsf{hypot}\left(1, x\right)}\\
\frac{\frac{\sqrt[3]{{\left(0.25 + \frac{-0.25}{\mathsf{fma}\left(x, x, 1\right)}\right)}^{2}} \cdot \sqrt[3]{0.5 + \frac{-0.5}{\mathsf{hypot}\left(1, x\right)}}}{{\left(\sqrt[3]{t_0}\right)}^{2}}}{1 + \sqrt{t_0}}
\end{array}
Initial program 15.2
Simplified15.2
Applied egg-rr14.7
Applied egg-rr14.7
Applied egg-rr15.2
Simplified14.7
Final simplification14.7
| Alternative 1 | |
|---|---|
| Error | 14.7 |
| Cost | 20352 |
| Alternative 2 | |
|---|---|
| Error | 14.7 |
| Cost | 20160 |
| Alternative 3 | |
|---|---|
| Error | 57.2 |
| Cost | 13312 |
| Alternative 4 | |
|---|---|
| Error | 15.2 |
| Cost | 13312 |
herbie shell --seed 2022334
(FPCore (x)
:name "Given's Rotation SVD example, simplified"
:precision binary64
(- 1.0 (sqrt (* 0.5 (+ 1.0 (/ 1.0 (hypot 1.0 x)))))))