| Alternative 1 | |
|---|---|
| Error | 55.4 |
| Cost | 580 |
\[\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 1:\\
\;\;\;\;10\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{-10}{x}}{x}\\
\end{array}
\]
(FPCore (x) :precision binary64 (/ 10.0 (- 1.0 (* x x))))
(FPCore (x) :precision binary64 (/ -10.0 (fma x x -1.0)))
double code(double x) {
return 10.0 / (1.0 - (x * x));
}
double code(double x) {
return -10.0 / fma(x, x, -1.0);
}
function code(x) return Float64(10.0 / Float64(1.0 - Float64(x * x))) end
function code(x) return Float64(-10.0 / fma(x, x, -1.0)) end
code[x_] := N[(10.0 / N[(1.0 - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_] := N[(-10.0 / N[(x * x + -1.0), $MachinePrecision]), $MachinePrecision]
\frac{10}{1 - x \cdot x}
\frac{-10}{\mathsf{fma}\left(x, x, -1\right)}
Initial program 7.8
Simplified0.3
Final simplification0.3
| Alternative 1 | |
|---|---|
| Error | 55.4 |
| Cost | 580 |
| Alternative 2 | |
|---|---|
| Error | 7.8 |
| Cost | 448 |
| Alternative 3 | |
|---|---|
| Error | 57.9 |
| Cost | 64 |

herbie shell --seed 2022295
(FPCore (x)
:name "ENA, Section 1.4, Mentioned, B"
:precision binary64
:pre (and (<= 0.999 x) (<= x 1.001))
(/ 10.0 (- 1.0 (* x x))))