| Alternative 1 | |
|---|---|
| Accuracy | 91.7% |
| Cost | 6857 |
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+103} \lor \neg \left(y \leq 2.7 \cdot 10^{+93}\right):\\
\;\;\;\;y \cdot \sqrt{x}\\
\mathbf{else}:\\
\;\;\;\;1 - x\\
\end{array}
\]
(FPCore (x y) :precision binary64 (+ (- 1.0 x) (* y (sqrt x))))
(FPCore (x y) :precision binary64 (fma y (sqrt x) (- 1.0 x)))
double code(double x, double y) {
return (1.0 - x) + (y * sqrt(x));
}
double code(double x, double y) {
return fma(y, sqrt(x), (1.0 - x));
}
function code(x, y) return Float64(Float64(1.0 - x) + Float64(y * sqrt(x))) end
function code(x, y) return fma(y, sqrt(x), Float64(1.0 - x)) end
code[x_, y_] := N[(N[(1.0 - x), $MachinePrecision] + N[(y * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(y * N[Sqrt[x], $MachinePrecision] + N[(1.0 - x), $MachinePrecision]), $MachinePrecision]
\left(1 - x\right) + y \cdot \sqrt{x}
\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)
Initial program 99.9%
Simplified99.9%
[Start]99.9 | \[ \left(1 - x\right) + y \cdot \sqrt{x}
\] |
|---|---|
+-commutative [=>]99.9 | \[ \color{blue}{y \cdot \sqrt{x} + \left(1 - x\right)}
\] |
fma-def [=>]99.9 | \[ \color{blue}{\mathsf{fma}\left(y, \sqrt{x}, 1 - x\right)}
\] |
Final simplification99.9%
| Alternative 1 | |
|---|---|
| Accuracy | 91.7% |
| Cost | 6857 |
| Alternative 2 | |
|---|---|
| Accuracy | 99.9% |
| Cost | 6848 |
| Alternative 3 | |
|---|---|
| Accuracy | 65.5% |
| Cost | 260 |
| Alternative 4 | |
|---|---|
| Accuracy | 66.6% |
| Cost | 192 |
| Alternative 5 | |
|---|---|
| Accuracy | 33.8% |
| Cost | 64 |
herbie shell --seed 2023137
(FPCore (x y)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, E"
:precision binary64
(+ (- 1.0 x) (* y (sqrt x))))