| Alternative 1 | |
|---|---|
| Error | 26.26% |
| Cost | 456 |
\[\begin{array}{l}
\mathbf{if}\;y \leq -1.08 \cdot 10^{-51}:\\
\;\;\;\;y \cdot -0.375\\
\mathbf{elif}\;y \leq 1.45 \cdot 10^{-37}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot -0.375\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- x (* (/ 3.0 8.0) y)))
(FPCore (x y) :precision binary64 (fma y -0.375 x))
double code(double x, double y) {
return x - ((3.0 / 8.0) * y);
}
double code(double x, double y) {
return fma(y, -0.375, x);
}
function code(x, y) return Float64(x - Float64(Float64(3.0 / 8.0) * y)) end
function code(x, y) return fma(y, -0.375, x) end
code[x_, y_] := N[(x - N[(N[(3.0 / 8.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
code[x_, y_] := N[(y * -0.375 + x), $MachinePrecision]
x - \frac{3}{8} \cdot y
\mathsf{fma}\left(y, -0.375, x\right)
Initial program 0.12
Simplified0
[Start]0.12 | \[ x - \frac{3}{8} \cdot y
\] |
|---|---|
cancel-sign-sub-inv [=>]0.12 | \[ \color{blue}{x + \left(-\frac{3}{8}\right) \cdot y}
\] |
+-commutative [=>]0.12 | \[ \color{blue}{\left(-\frac{3}{8}\right) \cdot y + x}
\] |
*-commutative [=>]0.12 | \[ \color{blue}{y \cdot \left(-\frac{3}{8}\right)} + x
\] |
fma-def [=>]0 | \[ \color{blue}{\mathsf{fma}\left(y, -\frac{3}{8}, x\right)}
\] |
metadata-eval [=>]0 | \[ \mathsf{fma}\left(y, -\color{blue}{0.375}, x\right)
\] |
metadata-eval [=>]0 | \[ \mathsf{fma}\left(y, \color{blue}{-0.375}, x\right)
\] |
Final simplification0
| Alternative 1 | |
|---|---|
| Error | 26.26% |
| Cost | 456 |
| Alternative 2 | |
|---|---|
| Error | 0.12% |
| Cost | 320 |
| Alternative 3 | |
|---|---|
| Error | 48.27% |
| Cost | 64 |
herbie shell --seed 2023102
(FPCore (x y)
:name "Diagrams.Solve.Polynomial:quartForm from diagrams-solve-0.1, A"
:precision binary64
(- x (* (/ 3.0 8.0) y)))