| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 585 |
\[\begin{array}{l}
\mathbf{if}\;x \leq -100000000000 \lor \neg \left(x \leq 1.45 \cdot 10^{-9}\right):\\
\;\;\;\;x \cdot \left(y + -1\right)\\
\mathbf{else}:\\
\;\;\;\;y - x\\
\end{array}
\]
(FPCore (x y) :precision binary64 (- (* (+ x 1.0) y) x))
(FPCore (x y) :precision binary64 (fma x y (- y x)))
double code(double x, double y) {
return ((x + 1.0) * y) - x;
}
double code(double x, double y) {
return fma(x, y, (y - x));
}
function code(x, y) return Float64(Float64(Float64(x + 1.0) * y) - x) end
function code(x, y) return fma(x, y, Float64(y - x)) end
code[x_, y_] := N[(N[(N[(x + 1.0), $MachinePrecision] * y), $MachinePrecision] - x), $MachinePrecision]
code[x_, y_] := N[(x * y + N[(y - x), $MachinePrecision]), $MachinePrecision]
\left(x + 1\right) \cdot y - x
\mathsf{fma}\left(x, y, y - x\right)
Initial program 0.0
Simplified0.0
[Start]0.0 | \[ \left(x + 1\right) \cdot y - x
\] |
|---|---|
sub-neg [=>]0.0 | \[ \color{blue}{\left(x + 1\right) \cdot y + \left(-x\right)}
\] |
*-commutative [=>]0.0 | \[ \color{blue}{y \cdot \left(x + 1\right)} + \left(-x\right)
\] |
distribute-lft-in [=>]0.0 | \[ \color{blue}{\left(y \cdot x + y \cdot 1\right)} + \left(-x\right)
\] |
associate-+l+ [=>]0.0 | \[ \color{blue}{y \cdot x + \left(y \cdot 1 + \left(-x\right)\right)}
\] |
*-commutative [=>]0.0 | \[ \color{blue}{x \cdot y} + \left(y \cdot 1 + \left(-x\right)\right)
\] |
*-lft-identity [<=]0.0 | \[ x \cdot \color{blue}{\left(1 \cdot y\right)} + \left(y \cdot 1 + \left(-x\right)\right)
\] |
*-commutative [<=]0.0 | \[ x \cdot \color{blue}{\left(y \cdot 1\right)} + \left(y \cdot 1 + \left(-x\right)\right)
\] |
fma-def [=>]0.0 | \[ \color{blue}{\mathsf{fma}\left(x, y \cdot 1, y \cdot 1 + \left(-x\right)\right)}
\] |
*-commutative [=>]0.0 | \[ \mathsf{fma}\left(x, \color{blue}{1 \cdot y}, y \cdot 1 + \left(-x\right)\right)
\] |
*-lft-identity [=>]0.0 | \[ \mathsf{fma}\left(x, \color{blue}{y}, y \cdot 1 + \left(-x\right)\right)
\] |
sub-neg [<=]0.0 | \[ \mathsf{fma}\left(x, y, \color{blue}{y \cdot 1 - x}\right)
\] |
*-commutative [=>]0.0 | \[ \mathsf{fma}\left(x, y, \color{blue}{1 \cdot y} - x\right)
\] |
*-lft-identity [=>]0.0 | \[ \mathsf{fma}\left(x, y, \color{blue}{y} - x\right)
\] |
Final simplification0.0
| Alternative 1 | |
|---|---|
| Error | 1.0 |
| Cost | 585 |
| Alternative 2 | |
|---|---|
| Error | 1.0 |
| Cost | 584 |
| Alternative 3 | |
|---|---|
| Error | 27.8 |
| Cost | 456 |
| Alternative 4 | |
|---|---|
| Error | 0.0 |
| Cost | 448 |
| Alternative 5 | |
|---|---|
| Error | 10.0 |
| Cost | 192 |
| Alternative 6 | |
|---|---|
| Error | 36.4 |
| Cost | 128 |
herbie shell --seed 2023011
(FPCore (x y)
:name "Data.Colour.SRGB:transferFunction from colour-2.3.3"
:precision binary64
(- (* (+ x 1.0) y) x))