| Alternative 1 | |
|---|---|
| Error | 1.8 |
| Cost | 1424 |
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- 1.0 (* y z)))))
(if (<= t_0 -5e+291)
(- x (* y (* z x)))
(if (<= t_0 1e+288) t_0 (* 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 t_0 = x * (1.0 - (y * z));
double tmp;
if (t_0 <= -5e+291) {
tmp = x - (y * (z * x));
} else if (t_0 <= 1e+288) {
tmp = t_0;
} else {
tmp = y * (z * -x);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (1.0d0 - (y * z))
end function
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: t_0
real(8) :: tmp
t_0 = x * (1.0d0 - (y * z))
if (t_0 <= (-5d+291)) then
tmp = x - (y * (z * x))
else if (t_0 <= 1d+288) then
tmp = t_0
else
tmp = y * (z * -x)
end if
code = tmp
end function
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 t_0 = x * (1.0 - (y * z));
double tmp;
if (t_0 <= -5e+291) {
tmp = x - (y * (z * x));
} else if (t_0 <= 1e+288) {
tmp = t_0;
} else {
tmp = y * (z * -x);
}
return tmp;
}
def code(x, y, z): return x * (1.0 - (y * z))
def code(x, y, z): t_0 = x * (1.0 - (y * z)) tmp = 0 if t_0 <= -5e+291: tmp = x - (y * (z * x)) elif t_0 <= 1e+288: tmp = t_0 else: tmp = 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) t_0 = Float64(x * Float64(1.0 - Float64(y * z))) tmp = 0.0 if (t_0 <= -5e+291) tmp = Float64(x - Float64(y * Float64(z * x))); elseif (t_0 <= 1e+288) tmp = t_0; else tmp = Float64(y * Float64(z * Float64(-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) t_0 = x * (1.0 - (y * z)); tmp = 0.0; if (t_0 <= -5e+291) tmp = x - (y * (z * x)); elseif (t_0 <= 1e+288) tmp = t_0; else tmp = 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_] := Block[{t$95$0 = N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e+291], N[(x - N[(y * N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+288], t$95$0, N[(y * N[(z * (-x)), $MachinePrecision]), $MachinePrecision]]]]
x \cdot \left(1 - y \cdot z\right)
\begin{array}{l}
t_0 := x \cdot \left(1 - y \cdot z\right)\\
\mathbf{if}\;t_0 \leq -5 \cdot 10^{+291}:\\
\;\;\;\;x - y \cdot \left(z \cdot x\right)\\
\mathbf{elif}\;t_0 \leq 10^{+288}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(z \cdot \left(-x\right)\right)\\
\end{array}
Results
if (*.f64 x (-.f64 1 (*.f64 y z))) < -5.0000000000000001e291Initial program 37.7
Taylor expanded in y around 0 9.9
Simplified9.9
[Start]9.9 | \[ -1 \cdot \left(y \cdot \left(z \cdot x\right)\right) + x
\] |
|---|---|
rational.json-simplify-1 [=>]9.9 | \[ \color{blue}{x + -1 \cdot \left(y \cdot \left(z \cdot x\right)\right)}
\] |
rational.json-simplify-43 [=>]9.9 | \[ x + \color{blue}{y \cdot \left(\left(z \cdot x\right) \cdot -1\right)}
\] |
rational.json-simplify-2 [=>]9.9 | \[ x + y \cdot \color{blue}{\left(-1 \cdot \left(z \cdot x\right)\right)}
\] |
rational.json-simplify-43 [=>]9.9 | \[ x + y \cdot \color{blue}{\left(z \cdot \left(x \cdot -1\right)\right)}
\] |
rational.json-simplify-9 [=>]9.9 | \[ x + y \cdot \left(z \cdot \color{blue}{\left(-x\right)}\right)
\] |
Taylor expanded in x around 0 37.7
Simplified9.9
[Start]37.7 | \[ \left(1 + -1 \cdot \left(y \cdot z\right)\right) \cdot x
\] |
|---|---|
rational.json-simplify-2 [=>]37.7 | \[ \color{blue}{x \cdot \left(1 + -1 \cdot \left(y \cdot z\right)\right)}
\] |
rational.json-simplify-1 [=>]37.7 | \[ x \cdot \color{blue}{\left(-1 \cdot \left(y \cdot z\right) + 1\right)}
\] |
rational.json-simplify-43 [=>]37.7 | \[ x \cdot \left(\color{blue}{y \cdot \left(z \cdot -1\right)} + 1\right)
\] |
rational.json-simplify-8 [<=]37.7 | \[ x \cdot \left(y \cdot \color{blue}{\left(-z\right)} + 1\right)
\] |
rational.json-simplify-1 [<=]37.7 | \[ x \cdot \color{blue}{\left(1 + y \cdot \left(-z\right)\right)}
\] |
rational.json-simplify-17 [=>]37.7 | \[ x \cdot \color{blue}{\left(y \cdot \left(-z\right) - -1\right)}
\] |
rational.json-simplify-8 [=>]37.7 | \[ x \cdot \left(y \cdot \color{blue}{\left(z \cdot -1\right)} - -1\right)
\] |
rational.json-simplify-43 [<=]37.7 | \[ x \cdot \left(\color{blue}{-1 \cdot \left(y \cdot z\right)} - -1\right)
\] |
rational.json-simplify-2 [=>]37.7 | \[ x \cdot \left(\color{blue}{\left(y \cdot z\right) \cdot -1} - -1\right)
\] |
rational.json-simplify-8 [<=]37.7 | \[ x \cdot \left(\color{blue}{\left(-y \cdot z\right)} - -1\right)
\] |
rational.json-simplify-12 [=>]37.7 | \[ x \cdot \left(\color{blue}{\left(0 - y \cdot z\right)} - -1\right)
\] |
rational.json-simplify-42 [=>]37.7 | \[ x \cdot \color{blue}{\left(\left(0 - -1\right) - y \cdot z\right)}
\] |
metadata-eval [=>]37.7 | \[ x \cdot \left(\color{blue}{1} - y \cdot z\right)
\] |
rational.json-simplify-48 [<=]37.7 | \[ \color{blue}{x \cdot 1 - \left(y \cdot z\right) \cdot x}
\] |
rational.json-simplify-2 [=>]37.7 | \[ \color{blue}{1 \cdot x} - \left(y \cdot z\right) \cdot x
\] |
rational.json-simplify-6 [=>]37.7 | \[ \color{blue}{x} - \left(y \cdot z\right) \cdot x
\] |
rational.json-simplify-2 [<=]37.7 | \[ x - \color{blue}{x \cdot \left(y \cdot z\right)}
\] |
rational.json-simplify-43 [=>]9.9 | \[ x - \color{blue}{y \cdot \left(z \cdot x\right)}
\] |
if -5.0000000000000001e291 < (*.f64 x (-.f64 1 (*.f64 y z))) < 1e288Initial program 0.1
if 1e288 < (*.f64 x (-.f64 1 (*.f64 y z))) Initial program 38.9
Taylor expanded in y around inf 16.9
Simplified16.9
[Start]16.9 | \[ -1 \cdot \left(y \cdot \left(z \cdot x\right)\right)
\] |
|---|---|
rational.json-simplify-43 [=>]16.9 | \[ \color{blue}{y \cdot \left(\left(z \cdot x\right) \cdot -1\right)}
\] |
rational.json-simplify-2 [=>]16.9 | \[ y \cdot \color{blue}{\left(-1 \cdot \left(z \cdot x\right)\right)}
\] |
rational.json-simplify-43 [=>]16.9 | \[ y \cdot \color{blue}{\left(z \cdot \left(x \cdot -1\right)\right)}
\] |
rational.json-simplify-9 [=>]16.9 | \[ y \cdot \left(z \cdot \color{blue}{\left(-x\right)}\right)
\] |
Final simplification1.2
| Alternative 1 | |
|---|---|
| Error | 1.8 |
| Cost | 1424 |
| Alternative 2 | |
|---|---|
| Error | 0.2 |
| Cost | 968 |
| Alternative 3 | |
|---|---|
| Error | 17.3 |
| Cost | 648 |
| Alternative 4 | |
|---|---|
| Error | 17.1 |
| Cost | 648 |
| Alternative 5 | |
|---|---|
| Error | 25.0 |
| Cost | 64 |
herbie shell --seed 2023077
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))