
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (* (- y z) (- t x))))
double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((y - z) * (t - x))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - z) * (t - x));
}
def code(x, y, z, t): return x + ((y - z) * (t - x))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - z) * Float64(t - x))) end
function tmp = code(x, y, z, t) tmp = x + ((y - z) * (t - x)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - z), $MachinePrecision] * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - z\right) \cdot \left(t - x\right)
\end{array}
(FPCore (x y z t) :precision binary64 (- x (* (- t x) (- z y))))
double code(double x, double y, double z, double t) {
return x - ((t - x) * (z - y));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x - ((t - x) * (z - y))
end function
public static double code(double x, double y, double z, double t) {
return x - ((t - x) * (z - y));
}
def code(x, y, z, t): return x - ((t - x) * (z - y))
function code(x, y, z, t) return Float64(x - Float64(Float64(t - x) * Float64(z - y))) end
function tmp = code(x, y, z, t) tmp = x - ((t - x) * (z - y)); end
code[x_, y_, z_, t_] := N[(x - N[(N[(t - x), $MachinePrecision] * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(t - x\right) \cdot \left(z - y\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* x y))) (t_2 (+ x (* x z))))
(if (<= x -1.15e+223)
t_1
(if (<= x -3.2e+124)
t_2
(if (<= x -1.5e+69)
t_1
(if (<= x 0.007)
(- x (* z t))
(if (or (<= x 3.3e+251) (not (<= x 3.3e+280))) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = x + (x * z);
double tmp;
if (x <= -1.15e+223) {
tmp = t_1;
} else if (x <= -3.2e+124) {
tmp = t_2;
} else if (x <= -1.5e+69) {
tmp = t_1;
} else if (x <= 0.007) {
tmp = x - (z * t);
} else if ((x <= 3.3e+251) || !(x <= 3.3e+280)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (x * y)
t_2 = x + (x * z)
if (x <= (-1.15d+223)) then
tmp = t_1
else if (x <= (-3.2d+124)) then
tmp = t_2
else if (x <= (-1.5d+69)) then
tmp = t_1
else if (x <= 0.007d0) then
tmp = x - (z * t)
else if ((x <= 3.3d+251) .or. (.not. (x <= 3.3d+280))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = x + (x * z);
double tmp;
if (x <= -1.15e+223) {
tmp = t_1;
} else if (x <= -3.2e+124) {
tmp = t_2;
} else if (x <= -1.5e+69) {
tmp = t_1;
} else if (x <= 0.007) {
tmp = x - (z * t);
} else if ((x <= 3.3e+251) || !(x <= 3.3e+280)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * y) t_2 = x + (x * z) tmp = 0 if x <= -1.15e+223: tmp = t_1 elif x <= -3.2e+124: tmp = t_2 elif x <= -1.5e+69: tmp = t_1 elif x <= 0.007: tmp = x - (z * t) elif (x <= 3.3e+251) or not (x <= 3.3e+280): tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * y)) t_2 = Float64(x + Float64(x * z)) tmp = 0.0 if (x <= -1.15e+223) tmp = t_1; elseif (x <= -3.2e+124) tmp = t_2; elseif (x <= -1.5e+69) tmp = t_1; elseif (x <= 0.007) tmp = Float64(x - Float64(z * t)); elseif ((x <= 3.3e+251) || !(x <= 3.3e+280)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * y); t_2 = x + (x * z); tmp = 0.0; if (x <= -1.15e+223) tmp = t_1; elseif (x <= -3.2e+124) tmp = t_2; elseif (x <= -1.5e+69) tmp = t_1; elseif (x <= 0.007) tmp = x - (z * t); elseif ((x <= 3.3e+251) || ~((x <= 3.3e+280))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15e+223], t$95$1, If[LessEqual[x, -3.2e+124], t$95$2, If[LessEqual[x, -1.5e+69], t$95$1, If[LessEqual[x, 0.007], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 3.3e+251], N[Not[LessEqual[x, 3.3e+280]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot y\\
t_2 := x + x \cdot z\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+223}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.2 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 0.007:\\
\;\;\;\;x - z \cdot t\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+251} \lor \neg \left(x \leq 3.3 \cdot 10^{+280}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.15000000000000002e223 or -3.19999999999999993e124 < x < -1.49999999999999992e69 or 3.30000000000000018e251 < x < 3.30000000000000003e280Initial program 100.0%
Taylor expanded in t around 0 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
if -1.15000000000000002e223 < x < -3.19999999999999993e124 or 0.00700000000000000015 < x < 3.30000000000000018e251 or 3.30000000000000003e280 < x Initial program 100.0%
Taylor expanded in y around 0 68.0%
mul-1-neg68.0%
distribute-lft-neg-out68.0%
*-commutative68.0%
Simplified68.0%
Taylor expanded in t around 0 60.2%
if -1.49999999999999992e69 < x < 0.00700000000000000015Initial program 100.0%
Taylor expanded in y around 0 67.8%
mul-1-neg67.8%
distribute-lft-neg-out67.8%
*-commutative67.8%
Simplified67.8%
Taylor expanded in t around inf 57.9%
mul-1-neg57.9%
*-commutative57.9%
distribute-rgt-neg-in57.9%
Simplified57.9%
Taylor expanded in x around 0 57.9%
mul-1-neg57.9%
sub-neg57.9%
Simplified57.9%
Final simplification63.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- x (* x y))) (t_2 (+ x (* x z))))
(if (<= x -1.14e+223)
t_1
(if (<= x -1.22e+124)
t_2
(if (<= x -3.4e+69)
t_1
(if (<= x 1.08e+187)
(- x (* t (- z y)))
(if (or (<= x 1.45e+255) (not (<= x 3.8e+280))) t_2 t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = x + (x * z);
double tmp;
if (x <= -1.14e+223) {
tmp = t_1;
} else if (x <= -1.22e+124) {
tmp = t_2;
} else if (x <= -3.4e+69) {
tmp = t_1;
} else if (x <= 1.08e+187) {
tmp = x - (t * (z - y));
} else if ((x <= 1.45e+255) || !(x <= 3.8e+280)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x - (x * y)
t_2 = x + (x * z)
if (x <= (-1.14d+223)) then
tmp = t_1
else if (x <= (-1.22d+124)) then
tmp = t_2
else if (x <= (-3.4d+69)) then
tmp = t_1
else if (x <= 1.08d+187) then
tmp = x - (t * (z - y))
else if ((x <= 1.45d+255) .or. (.not. (x <= 3.8d+280))) then
tmp = t_2
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x - (x * y);
double t_2 = x + (x * z);
double tmp;
if (x <= -1.14e+223) {
tmp = t_1;
} else if (x <= -1.22e+124) {
tmp = t_2;
} else if (x <= -3.4e+69) {
tmp = t_1;
} else if (x <= 1.08e+187) {
tmp = x - (t * (z - y));
} else if ((x <= 1.45e+255) || !(x <= 3.8e+280)) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x - (x * y) t_2 = x + (x * z) tmp = 0 if x <= -1.14e+223: tmp = t_1 elif x <= -1.22e+124: tmp = t_2 elif x <= -3.4e+69: tmp = t_1 elif x <= 1.08e+187: tmp = x - (t * (z - y)) elif (x <= 1.45e+255) or not (x <= 3.8e+280): tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x - Float64(x * y)) t_2 = Float64(x + Float64(x * z)) tmp = 0.0 if (x <= -1.14e+223) tmp = t_1; elseif (x <= -1.22e+124) tmp = t_2; elseif (x <= -3.4e+69) tmp = t_1; elseif (x <= 1.08e+187) tmp = Float64(x - Float64(t * Float64(z - y))); elseif ((x <= 1.45e+255) || !(x <= 3.8e+280)) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x - (x * y); t_2 = x + (x * z); tmp = 0.0; if (x <= -1.14e+223) tmp = t_1; elseif (x <= -1.22e+124) tmp = t_2; elseif (x <= -3.4e+69) tmp = t_1; elseif (x <= 1.08e+187) tmp = x - (t * (z - y)); elseif ((x <= 1.45e+255) || ~((x <= 3.8e+280))) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.14e+223], t$95$1, If[LessEqual[x, -1.22e+124], t$95$2, If[LessEqual[x, -3.4e+69], t$95$1, If[LessEqual[x, 1.08e+187], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 1.45e+255], N[Not[LessEqual[x, 3.8e+280]], $MachinePrecision]], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - x \cdot y\\
t_2 := x + x \cdot z\\
\mathbf{if}\;x \leq -1.14 \cdot 10^{+223}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.22 \cdot 10^{+124}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -3.4 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{+187}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+255} \lor \neg \left(x \leq 3.8 \cdot 10^{+280}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.13999999999999999e223 or -1.22e124 < x < -3.39999999999999986e69 or 1.4500000000000001e255 < x < 3.79999999999999964e280Initial program 100.0%
Taylor expanded in t around 0 100.0%
mul-1-neg100.0%
distribute-lft-neg-out100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in z around 0 85.6%
mul-1-neg85.6%
unsub-neg85.6%
Simplified85.6%
if -1.13999999999999999e223 < x < -1.22e124 or 1.08e187 < x < 1.4500000000000001e255 or 3.79999999999999964e280 < x Initial program 100.0%
Taylor expanded in y around 0 70.8%
mul-1-neg70.8%
distribute-lft-neg-out70.8%
*-commutative70.8%
Simplified70.8%
Taylor expanded in t around 0 66.5%
if -3.39999999999999986e69 < x < 1.08e187Initial program 100.0%
Taylor expanded in t around inf 77.8%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.3e+42) (not (<= x 6.7e+66))) (+ x (* x (- z y))) (- x (* t (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e+42) || !(x <= 6.7e+66)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.3d+42)) .or. (.not. (x <= 6.7d+66))) then
tmp = x + (x * (z - y))
else
tmp = x - (t * (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.3e+42) || !(x <= 6.7e+66)) {
tmp = x + (x * (z - y));
} else {
tmp = x - (t * (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.3e+42) or not (x <= 6.7e+66): tmp = x + (x * (z - y)) else: tmp = x - (t * (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.3e+42) || !(x <= 6.7e+66)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x - Float64(t * Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.3e+42) || ~((x <= 6.7e+66))) tmp = x + (x * (z - y)); else tmp = x - (t * (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.3e+42], N[Not[LessEqual[x, 6.7e+66]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+42} \lor \neg \left(x \leq 6.7 \cdot 10^{+66}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \left(z - y\right)\\
\end{array}
\end{array}
if x < -2.3e42 or 6.69999999999999969e66 < x Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in93.4%
Applied egg-rr93.4%
Taylor expanded in t around 0 80.0%
mul-1-neg80.0%
distribute-rgt-neg-in80.0%
mul-1-neg80.0%
distribute-lft-in85.8%
+-commutative85.8%
mul-1-neg85.8%
sub-neg85.8%
Simplified85.8%
if -2.3e42 < x < 6.69999999999999969e66Initial program 100.0%
Taylor expanded in t around inf 83.1%
Final simplification84.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1e-6) (not (<= z 1.4e-8))) (+ x (* z (- x t))) (+ x (* y (- t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-6) || !(z <= 1.4e-8)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1d-6)) .or. (.not. (z <= 1.4d-8))) then
tmp = x + (z * (x - t))
else
tmp = x + (y * (t - x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1e-6) || !(z <= 1.4e-8)) {
tmp = x + (z * (x - t));
} else {
tmp = x + (y * (t - x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1e-6) or not (z <= 1.4e-8): tmp = x + (z * (x - t)) else: tmp = x + (y * (t - x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1e-6) || !(z <= 1.4e-8)) tmp = Float64(x + Float64(z * Float64(x - t))); else tmp = Float64(x + Float64(y * Float64(t - x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1e-6) || ~((z <= 1.4e-8))) tmp = x + (z * (x - t)); else tmp = x + (y * (t - x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1e-6], N[Not[LessEqual[z, 1.4e-8]], $MachinePrecision]], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-6} \lor \neg \left(z \leq 1.4 \cdot 10^{-8}\right):\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\end{array}
\end{array}
if z < -9.99999999999999955e-7 or 1.4e-8 < z Initial program 100.0%
Taylor expanded in y around 0 82.3%
mul-1-neg82.3%
distribute-lft-neg-out82.3%
*-commutative82.3%
Simplified82.3%
if -9.99999999999999955e-7 < z < 1.4e-8Initial program 100.0%
Taylor expanded in y around inf 94.0%
*-commutative94.0%
Simplified94.0%
Final simplification87.0%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x z) (if (<= z 4.5e-192) x (if (<= z 2.05e+73) (* x (- y)) (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.5e-192) {
tmp = x;
} else if (z <= 2.05e+73) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.0d0)) then
tmp = x * z
else if (z <= 4.5d-192) then
tmp = x
else if (z <= 2.05d+73) then
tmp = x * -y
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * z;
} else if (z <= 4.5e-192) {
tmp = x;
} else if (z <= 2.05e+73) {
tmp = x * -y;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * z elif z <= 4.5e-192: tmp = x elif z <= 2.05e+73: tmp = x * -y else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * z); elseif (z <= 4.5e-192) tmp = x; elseif (z <= 2.05e+73) tmp = Float64(x * Float64(-y)); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * z; elseif (z <= 4.5e-192) tmp = x; elseif (z <= 2.05e+73) tmp = x * -y; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * z), $MachinePrecision], If[LessEqual[z, 4.5e-192], x, If[LessEqual[z, 2.05e+73], N[(x * (-y)), $MachinePrecision], N[(x * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-192}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.05 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1 or 2.0499999999999999e73 < z Initial program 100.0%
Taylor expanded in y around 0 85.3%
mul-1-neg85.3%
distribute-lft-neg-out85.3%
*-commutative85.3%
Simplified85.3%
Taylor expanded in t around 0 44.5%
Taylor expanded in z around inf 44.4%
*-commutative44.4%
Simplified44.4%
if -1 < z < 4.50000000000000024e-192Initial program 100.0%
Taylor expanded in y around 0 41.4%
mul-1-neg41.4%
distribute-lft-neg-out41.4%
*-commutative41.4%
Simplified41.4%
Taylor expanded in z around 0 34.5%
if 4.50000000000000024e-192 < z < 2.0499999999999999e73Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in97.9%
Applied egg-rr97.9%
Taylor expanded in t around 0 57.9%
mul-1-neg57.9%
distribute-rgt-neg-in57.9%
mul-1-neg57.9%
distribute-lft-in57.9%
+-commutative57.9%
mul-1-neg57.9%
sub-neg57.9%
Simplified57.9%
Taylor expanded in y around inf 33.2%
mul-1-neg33.2%
*-commutative33.2%
distribute-lft-neg-in33.2%
Simplified33.2%
Final simplification39.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8e+36) (not (<= y 3e+19))) (* x (- y)) (+ x (* x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e+36) || !(y <= 3e+19)) {
tmp = x * -y;
} else {
tmp = x + (x * z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-8d+36)) .or. (.not. (y <= 3d+19))) then
tmp = x * -y
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8e+36) || !(y <= 3e+19)) {
tmp = x * -y;
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8e+36) or not (y <= 3e+19): tmp = x * -y else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8e+36) || !(y <= 3e+19)) tmp = Float64(x * Float64(-y)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8e+36) || ~((y <= 3e+19))) tmp = x * -y; else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8e+36], N[Not[LessEqual[y, 3e+19]], $MachinePrecision]], N[(x * (-y)), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8 \cdot 10^{+36} \lor \neg \left(y \leq 3 \cdot 10^{+19}\right):\\
\;\;\;\;x \cdot \left(-y\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if y < -8.00000000000000034e36 or 3e19 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in89.2%
Applied egg-rr89.2%
Taylor expanded in t around 0 45.5%
mul-1-neg45.5%
distribute-rgt-neg-in45.5%
mul-1-neg45.5%
distribute-lft-in51.8%
+-commutative51.8%
mul-1-neg51.8%
sub-neg51.8%
Simplified51.8%
Taylor expanded in y around inf 39.9%
mul-1-neg39.9%
*-commutative39.9%
distribute-lft-neg-in39.9%
Simplified39.9%
if -8.00000000000000034e36 < y < 3e19Initial program 100.0%
Taylor expanded in y around 0 88.1%
mul-1-neg88.1%
distribute-lft-neg-out88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in t around 0 53.7%
Final simplification47.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e-8) (not (<= z 2.15e+73))) (+ x (* x z)) (+ x (* y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-8) || !(z <= 2.15e+73)) {
tmp = x + (x * z);
} else {
tmp = x + (y * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.8d-8)) .or. (.not. (z <= 2.15d+73))) then
tmp = x + (x * z)
else
tmp = x + (y * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e-8) || !(z <= 2.15e+73)) {
tmp = x + (x * z);
} else {
tmp = x + (y * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e-8) or not (z <= 2.15e+73): tmp = x + (x * z) else: tmp = x + (y * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e-8) || !(z <= 2.15e+73)) tmp = Float64(x + Float64(x * z)); else tmp = Float64(x + Float64(y * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e-8) || ~((z <= 2.15e+73))) tmp = x + (x * z); else tmp = x + (y * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e-8], N[Not[LessEqual[z, 2.15e+73]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-8} \lor \neg \left(z \leq 2.15 \cdot 10^{+73}\right):\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot t\\
\end{array}
\end{array}
if z < -4.79999999999999997e-8 or 2.15000000000000007e73 < z Initial program 100.0%
Taylor expanded in y around 0 84.6%
mul-1-neg84.6%
distribute-lft-neg-out84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in t around 0 44.0%
if -4.79999999999999997e-8 < z < 2.15000000000000007e73Initial program 100.0%
Taylor expanded in y around inf 88.2%
*-commutative88.2%
Simplified88.2%
Taylor expanded in t around inf 63.2%
*-commutative63.2%
Simplified63.2%
Final simplification52.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1950000000000.0) (not (<= x 1.1))) (+ x (* x z)) (- x (* z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1950000000000.0) || !(x <= 1.1)) {
tmp = x + (x * z);
} else {
tmp = x - (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1950000000000.0d0)) .or. (.not. (x <= 1.1d0))) then
tmp = x + (x * z)
else
tmp = x - (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1950000000000.0) || !(x <= 1.1)) {
tmp = x + (x * z);
} else {
tmp = x - (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1950000000000.0) or not (x <= 1.1): tmp = x + (x * z) else: tmp = x - (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1950000000000.0) || !(x <= 1.1)) tmp = Float64(x + Float64(x * z)); else tmp = Float64(x - Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1950000000000.0) || ~((x <= 1.1))) tmp = x + (x * z); else tmp = x - (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1950000000000.0], N[Not[LessEqual[x, 1.1]], $MachinePrecision]], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1950000000000 \lor \neg \left(x \leq 1.1\right):\\
\;\;\;\;x + x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot t\\
\end{array}
\end{array}
if x < -1.95e12 or 1.1000000000000001 < x Initial program 100.0%
Taylor expanded in y around 0 62.1%
mul-1-neg62.1%
distribute-lft-neg-out62.1%
*-commutative62.1%
Simplified62.1%
Taylor expanded in t around 0 55.6%
if -1.95e12 < x < 1.1000000000000001Initial program 100.0%
Taylor expanded in y around 0 67.0%
mul-1-neg67.0%
distribute-lft-neg-out67.0%
*-commutative67.0%
Simplified67.0%
Taylor expanded in t around inf 58.4%
mul-1-neg58.4%
*-commutative58.4%
distribute-rgt-neg-in58.4%
Simplified58.4%
Taylor expanded in x around 0 58.4%
mul-1-neg58.4%
sub-neg58.4%
Simplified58.4%
Final simplification56.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 5600000000000.0))) (* x z) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 5600000000000.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 5600000000000.0d0))) then
tmp = x * z
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 5600000000000.0)) {
tmp = x * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 5600000000000.0): tmp = x * z else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 5600000000000.0)) tmp = Float64(x * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 5600000000000.0))) tmp = x * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 5600000000000.0]], $MachinePrecision]], N[(x * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 5600000000000\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1 or 5.6e12 < z Initial program 100.0%
Taylor expanded in y around 0 82.5%
mul-1-neg82.5%
distribute-lft-neg-out82.5%
*-commutative82.5%
Simplified82.5%
Taylor expanded in t around 0 42.3%
Taylor expanded in z around inf 42.3%
*-commutative42.3%
Simplified42.3%
if -1 < z < 5.6e12Initial program 100.0%
Taylor expanded in y around 0 40.2%
mul-1-neg40.2%
distribute-lft-neg-out40.2%
*-commutative40.2%
Simplified40.2%
Taylor expanded in z around 0 31.3%
Final simplification37.6%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 64.4%
mul-1-neg64.4%
distribute-lft-neg-out64.4%
*-commutative64.4%
Simplified64.4%
Taylor expanded in z around 0 15.0%
Final simplification15.0%
(FPCore (x y z t) :precision binary64 (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x + ((t * (y - z)) + (-x * (y - z)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t * (y - z)) + (-x * (y - z)));
}
def code(x, y, z, t): return x + ((t * (y - z)) + (-x * (y - z)))
function code(x, y, z, t) return Float64(x + Float64(Float64(t * Float64(y - z)) + Float64(Float64(-x) * Float64(y - z)))) end
function tmp = code(x, y, z, t) tmp = x + ((t * (y - z)) + (-x * (y - z))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision] + N[((-x) * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t \cdot \left(y - z\right) + \left(-x\right) \cdot \left(y - z\right)\right)
\end{array}
herbie shell --seed 2023308
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:herbie-target
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))