| Alternative 1 | |
|---|---|
| Error | 1.6 |
| Cost | 708 |
\[\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\end{array}
\]
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z) :precision binary64 (if (<= (* y z) (- INFINITY)) (* y (* z (- x))) (- x (* (* y z) x))))
double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -((double) INFINITY)) {
tmp = y * (z * -x);
} else {
tmp = x - ((y * z) * x);
}
return tmp;
}
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
public static double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -Double.POSITIVE_INFINITY) {
tmp = y * (z * -x);
} else {
tmp = x - ((y * z) * x);
}
return tmp;
}
def code(x, y, z): return x * (1.0 - (y * z))
def code(x, y, z): tmp = 0 if (y * z) <= -math.inf: tmp = y * (z * -x) else: tmp = x - ((y * z) * x) return tmp
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= Float64(-Inf)) tmp = Float64(y * Float64(z * Float64(-x))); else tmp = Float64(x - Float64(Float64(y * z) * x)); end return tmp end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y * z) <= -Inf) tmp = y * (z * -x); else tmp = x - ((y * z) * x); end tmp_2 = tmp; end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_] := If[LessEqual[N[(y * z), $MachinePrecision], (-Infinity)], N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * z), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -\infty:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - \left(y \cdot z\right) \cdot x\\
\end{array}
Results
if (*.f64 y z) < -inf.0Initial program 64.0
Taylor expanded in y around inf 0.2
Simplified0.2
if -inf.0 < (*.f64 y z) Initial program 1.6
Applied egg-rr2.9
Applied egg-rr1.6
Simplified1.6
Final simplification1.6
| Alternative 1 | |
|---|---|
| Error | 1.6 |
| Cost | 708 |
| Alternative 2 | |
|---|---|
| Error | 21.8 |
| Cost | 648 |
| Alternative 3 | |
|---|---|
| Error | 21.0 |
| Cost | 648 |
| Alternative 4 | |
|---|---|
| Error | 20.2 |
| Cost | 648 |
| Alternative 5 | |
|---|---|
| Error | 25.5 |
| Cost | 64 |
herbie shell --seed 2022325
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))