
(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 13 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) (- y z))))
double code(double x, double y, double z, double t) {
return x + ((t - 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 - x) * (y - z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((t - x) * (y - z));
}
def code(x, y, z, t): return x + ((t - x) * (y - z))
function code(x, y, z, t) return Float64(x + Float64(Float64(t - x) * Float64(y - z))) end
function tmp = code(x, y, z, t) tmp = x + ((t - x) * (y - z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(t - x), $MachinePrecision] * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(t - x\right) \cdot \left(y - z\right)
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))) (t_2 (* z (- t))))
(if (<= y -3.7e+14)
t_1
(if (<= y -2.55e-48)
t_2
(if (<= y -2.7e-191)
x
(if (<= y 3.7e+42) t_2 (if (<= y 8e+187) t_1 (* y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double t_2 = z * -t;
double tmp;
if (y <= -3.7e+14) {
tmp = t_1;
} else if (y <= -2.55e-48) {
tmp = t_2;
} else if (y <= -2.7e-191) {
tmp = x;
} else if (y <= 3.7e+42) {
tmp = t_2;
} else if (y <= 8e+187) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * -y
t_2 = z * -t
if (y <= (-3.7d+14)) then
tmp = t_1
else if (y <= (-2.55d-48)) then
tmp = t_2
else if (y <= (-2.7d-191)) then
tmp = x
else if (y <= 3.7d+42) then
tmp = t_2
else if (y <= 8d+187) then
tmp = t_1
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double t_2 = z * -t;
double tmp;
if (y <= -3.7e+14) {
tmp = t_1;
} else if (y <= -2.55e-48) {
tmp = t_2;
} else if (y <= -2.7e-191) {
tmp = x;
} else if (y <= 3.7e+42) {
tmp = t_2;
} else if (y <= 8e+187) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * -y t_2 = z * -t tmp = 0 if y <= -3.7e+14: tmp = t_1 elif y <= -2.55e-48: tmp = t_2 elif y <= -2.7e-191: tmp = x elif y <= 3.7e+42: tmp = t_2 elif y <= 8e+187: tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) t_2 = Float64(z * Float64(-t)) tmp = 0.0 if (y <= -3.7e+14) tmp = t_1; elseif (y <= -2.55e-48) tmp = t_2; elseif (y <= -2.7e-191) tmp = x; elseif (y <= 3.7e+42) tmp = t_2; elseif (y <= 8e+187) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * -y; t_2 = z * -t; tmp = 0.0; if (y <= -3.7e+14) tmp = t_1; elseif (y <= -2.55e-48) tmp = t_2; elseif (y <= -2.7e-191) tmp = x; elseif (y <= 3.7e+42) tmp = t_2; elseif (y <= 8e+187) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, Block[{t$95$2 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[y, -3.7e+14], t$95$1, If[LessEqual[y, -2.55e-48], t$95$2, If[LessEqual[y, -2.7e-191], x, If[LessEqual[y, 3.7e+42], t$95$2, If[LessEqual[y, 8e+187], t$95$1, N[(y * t), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
t_2 := z \cdot \left(-t\right)\\
\mathbf{if}\;y \leq -3.7 \cdot 10^{+14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-191}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 3.7 \cdot 10^{+42}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+187}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -3.7e14 or 3.69999999999999996e42 < y < 7.99999999999999926e187Initial program 100.0%
Taylor expanded in t around 0 62.8%
mul-1-neg62.8%
distribute-rgt-neg-in62.8%
sub-neg62.8%
+-commutative62.8%
distribute-neg-in62.8%
remove-double-neg62.8%
sub-neg62.8%
Simplified62.8%
Taylor expanded in z around 0 56.7%
mul-1-neg56.7%
*-rgt-identity56.7%
distribute-rgt-neg-out56.7%
distribute-lft-in56.7%
unsub-neg56.7%
Simplified56.7%
Taylor expanded in y around inf 56.7%
mul-1-neg56.7%
*-commutative56.7%
distribute-rgt-neg-in56.7%
Simplified56.7%
if -3.7e14 < y < -2.55000000000000006e-48 or -2.69999999999999999e-191 < y < 3.69999999999999996e42Initial program 100.0%
Taylor expanded in t around inf 76.4%
Taylor expanded in y around 0 69.8%
mul-1-neg69.8%
unsub-neg69.8%
*-commutative69.8%
Simplified69.8%
Taylor expanded in x around 0 46.4%
neg-mul-146.4%
distribute-lft-neg-in46.4%
Simplified46.4%
if -2.55000000000000006e-48 < y < -2.69999999999999999e-191Initial program 100.0%
Taylor expanded in y around inf 60.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in y around 0 47.0%
if 7.99999999999999926e187 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in83.3%
Applied egg-rr83.3%
Taylor expanded in x around 0 59.4%
associate-+r+59.4%
mul-1-neg59.4%
*-commutative59.4%
sub-neg59.4%
associate-+l-59.4%
*-commutative59.4%
Applied egg-rr59.4%
Taylor expanded in y around inf 59.5%
Final simplification51.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- y))))
(if (<= y -1.8e+21)
t_1
(if (<= y -9.6e-49)
(* x z)
(if (<= y 0.0043) x (if (<= y 2.32e+188) t_1 (* y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -1.8e+21) {
tmp = t_1;
} else if (y <= -9.6e-49) {
tmp = x * z;
} else if (y <= 0.0043) {
tmp = x;
} else if (y <= 2.32e+188) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = x * -y
if (y <= (-1.8d+21)) then
tmp = t_1
else if (y <= (-9.6d-49)) then
tmp = x * z
else if (y <= 0.0043d0) then
tmp = x
else if (y <= 2.32d+188) then
tmp = t_1
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * -y;
double tmp;
if (y <= -1.8e+21) {
tmp = t_1;
} else if (y <= -9.6e-49) {
tmp = x * z;
} else if (y <= 0.0043) {
tmp = x;
} else if (y <= 2.32e+188) {
tmp = t_1;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * -y tmp = 0 if y <= -1.8e+21: tmp = t_1 elif y <= -9.6e-49: tmp = x * z elif y <= 0.0043: tmp = x elif y <= 2.32e+188: tmp = t_1 else: tmp = y * t return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(-y)) tmp = 0.0 if (y <= -1.8e+21) tmp = t_1; elseif (y <= -9.6e-49) tmp = Float64(x * z); elseif (y <= 0.0043) tmp = x; elseif (y <= 2.32e+188) tmp = t_1; else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * -y; tmp = 0.0; if (y <= -1.8e+21) tmp = t_1; elseif (y <= -9.6e-49) tmp = x * z; elseif (y <= 0.0043) tmp = x; elseif (y <= 2.32e+188) tmp = t_1; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * (-y)), $MachinePrecision]}, If[LessEqual[y, -1.8e+21], t$95$1, If[LessEqual[y, -9.6e-49], N[(x * z), $MachinePrecision], If[LessEqual[y, 0.0043], x, If[LessEqual[y, 2.32e+188], t$95$1, N[(y * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(-y\right)\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+21}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -9.6 \cdot 10^{-49}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;y \leq 0.0043:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 2.32 \cdot 10^{+188}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if y < -1.8e21 or 0.0043 < y < 2.3200000000000001e188Initial program 100.0%
Taylor expanded in t around 0 62.1%
mul-1-neg62.1%
distribute-rgt-neg-in62.1%
sub-neg62.1%
+-commutative62.1%
distribute-neg-in62.1%
remove-double-neg62.1%
sub-neg62.1%
Simplified62.1%
Taylor expanded in z around 0 54.8%
mul-1-neg54.8%
*-rgt-identity54.8%
distribute-rgt-neg-out54.8%
distribute-lft-in54.8%
unsub-neg54.8%
Simplified54.8%
Taylor expanded in y around inf 54.2%
mul-1-neg54.2%
*-commutative54.2%
distribute-rgt-neg-in54.2%
Simplified54.2%
if -1.8e21 < y < -9.59999999999999969e-49Initial program 100.0%
Taylor expanded in t around 0 46.9%
mul-1-neg46.9%
distribute-rgt-neg-in46.9%
sub-neg46.9%
+-commutative46.9%
distribute-neg-in46.9%
remove-double-neg46.9%
sub-neg46.9%
Simplified46.9%
Taylor expanded in z around inf 46.9%
Taylor expanded in z around inf 46.9%
if -9.59999999999999969e-49 < y < 0.0043Initial program 100.0%
Taylor expanded in y around inf 44.0%
*-commutative44.0%
Simplified44.0%
Taylor expanded in y around 0 35.8%
if 2.3200000000000001e188 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in83.3%
Applied egg-rr83.3%
Taylor expanded in x around 0 59.4%
associate-+r+59.4%
mul-1-neg59.4%
*-commutative59.4%
sub-neg59.4%
associate-+l-59.4%
*-commutative59.4%
Applied egg-rr59.4%
Taylor expanded in y around inf 59.5%
Final simplification46.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* x (- z y)))))
(if (<= x -1.1e-87)
t_1
(if (<= x 2.5e-91)
(* t (- y z))
(if (<= x 850000000.0) (+ x (* y (- t x))) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (x * (z - y));
double tmp;
if (x <= -1.1e-87) {
tmp = t_1;
} else if (x <= 2.5e-91) {
tmp = t * (y - z);
} else if (x <= 850000000.0) {
tmp = x + (y * (t - x));
} 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) :: tmp
t_1 = x + (x * (z - y))
if (x <= (-1.1d-87)) then
tmp = t_1
else if (x <= 2.5d-91) then
tmp = t * (y - z)
else if (x <= 850000000.0d0) then
tmp = x + (y * (t - x))
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 * (z - y));
double tmp;
if (x <= -1.1e-87) {
tmp = t_1;
} else if (x <= 2.5e-91) {
tmp = t * (y - z);
} else if (x <= 850000000.0) {
tmp = x + (y * (t - x));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (x * (z - y)) tmp = 0 if x <= -1.1e-87: tmp = t_1 elif x <= 2.5e-91: tmp = t * (y - z) elif x <= 850000000.0: tmp = x + (y * (t - x)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(x * Float64(z - y))) tmp = 0.0 if (x <= -1.1e-87) tmp = t_1; elseif (x <= 2.5e-91) tmp = Float64(t * Float64(y - z)); elseif (x <= 850000000.0) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (x * (z - y)); tmp = 0.0; if (x <= -1.1e-87) tmp = t_1; elseif (x <= 2.5e-91) tmp = t * (y - z); elseif (x <= 850000000.0) tmp = x + (y * (t - x)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e-87], t$95$1, If[LessEqual[x, 2.5e-91], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 850000000.0], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + x \cdot \left(z - y\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{-87}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-91}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{elif}\;x \leq 850000000:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.09999999999999994e-87 or 8.5e8 < x Initial program 100.0%
Taylor expanded in t around 0 84.0%
mul-1-neg84.0%
distribute-rgt-neg-in84.0%
sub-neg84.0%
+-commutative84.0%
distribute-neg-in84.0%
remove-double-neg84.0%
sub-neg84.0%
Simplified84.0%
if -1.09999999999999994e-87 < x < 2.49999999999999999e-91Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 87.0%
associate-+r+87.0%
mul-1-neg87.0%
*-commutative87.0%
sub-neg87.0%
associate-+l-87.0%
*-commutative87.0%
Applied egg-rr87.0%
Taylor expanded in x around 0 81.1%
distribute-lft-out--82.1%
Simplified82.1%
if 2.49999999999999999e-91 < x < 8.5e8Initial program 100.0%
Taylor expanded in y around inf 81.5%
*-commutative81.5%
Simplified81.5%
Final simplification83.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.2e+14) (not (<= y 2.55e+42))) (+ x (* y (- t x))) (+ x (* z (- x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e+14) || !(y <= 2.55e+42)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - 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 ((y <= (-6.2d+14)) .or. (.not. (y <= 2.55d+42))) then
tmp = x + (y * (t - x))
else
tmp = x + (z * (x - t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e+14) || !(y <= 2.55e+42)) {
tmp = x + (y * (t - x));
} else {
tmp = x + (z * (x - t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.2e+14) or not (y <= 2.55e+42): tmp = x + (y * (t - x)) else: tmp = x + (z * (x - t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.2e+14) || !(y <= 2.55e+42)) tmp = Float64(x + Float64(y * Float64(t - x))); else tmp = Float64(x + Float64(z * Float64(x - t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6.2e+14) || ~((y <= 2.55e+42))) tmp = x + (y * (t - x)); else tmp = x + (z * (x - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.2e+14], N[Not[LessEqual[y, 2.55e+42]], $MachinePrecision]], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+14} \lor \neg \left(y \leq 2.55 \cdot 10^{+42}\right):\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x - t\right)\\
\end{array}
\end{array}
if y < -6.2e14 or 2.55e42 < y Initial program 100.0%
Taylor expanded in y around inf 86.7%
*-commutative86.7%
Simplified86.7%
if -6.2e14 < y < 2.55e42Initial program 100.0%
Taylor expanded in y around 0 88.9%
mul-1-neg88.9%
unsub-neg88.9%
Simplified88.9%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -9.5e-38) (not (<= x 2.7e-12))) (+ x (* x (- z y))) (+ x (* t (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-38) || !(x <= 2.7e-12)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - 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 ((x <= (-9.5d-38)) .or. (.not. (x <= 2.7d-12))) then
tmp = x + (x * (z - y))
else
tmp = x + (t * (y - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -9.5e-38) || !(x <= 2.7e-12)) {
tmp = x + (x * (z - y));
} else {
tmp = x + (t * (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -9.5e-38) or not (x <= 2.7e-12): tmp = x + (x * (z - y)) else: tmp = x + (t * (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -9.5e-38) || !(x <= 2.7e-12)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(t * Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -9.5e-38) || ~((x <= 2.7e-12))) tmp = x + (x * (z - y)); else tmp = x + (t * (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -9.5e-38], N[Not[LessEqual[x, 2.7e-12]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.5 \cdot 10^{-38} \lor \neg \left(x \leq 2.7 \cdot 10^{-12}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -9.5000000000000009e-38 or 2.6999999999999998e-12 < x Initial program 100.0%
Taylor expanded in t around 0 85.2%
mul-1-neg85.2%
distribute-rgt-neg-in85.2%
sub-neg85.2%
+-commutative85.2%
distribute-neg-in85.2%
remove-double-neg85.2%
sub-neg85.2%
Simplified85.2%
if -9.5000000000000009e-38 < x < 2.6999999999999998e-12Initial program 100.0%
Taylor expanded in t around inf 84.3%
Final simplification84.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.3e-87) (not (<= x 3.3e-91))) (+ x (* x (- z y))) (* t (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.3e-87) || !(x <= 3.3e-91)) {
tmp = x + (x * (z - y));
} else {
tmp = t * (y - 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 ((x <= (-1.3d-87)) .or. (.not. (x <= 3.3d-91))) then
tmp = x + (x * (z - y))
else
tmp = t * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.3e-87) || !(x <= 3.3e-91)) {
tmp = x + (x * (z - y));
} else {
tmp = t * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.3e-87) or not (x <= 3.3e-91): tmp = x + (x * (z - y)) else: tmp = t * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.3e-87) || !(x <= 3.3e-91)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(t * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.3e-87) || ~((x <= 3.3e-91))) tmp = x + (x * (z - y)); else tmp = t * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.3e-87], N[Not[LessEqual[x, 3.3e-91]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{-87} \lor \neg \left(x \leq 3.3 \cdot 10^{-91}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -1.30000000000000001e-87 or 3.30000000000000011e-91 < x Initial program 100.0%
Taylor expanded in t around 0 80.9%
mul-1-neg80.9%
distribute-rgt-neg-in80.9%
sub-neg80.9%
+-commutative80.9%
distribute-neg-in80.9%
remove-double-neg80.9%
sub-neg80.9%
Simplified80.9%
if -1.30000000000000001e-87 < x < 3.30000000000000011e-91Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.9%
Applied egg-rr98.9%
Taylor expanded in x around 0 87.0%
associate-+r+87.0%
mul-1-neg87.0%
*-commutative87.0%
sub-neg87.0%
associate-+l-87.0%
*-commutative87.0%
Applied egg-rr87.0%
Taylor expanded in x around 0 81.1%
distribute-lft-out--82.1%
Simplified82.1%
Final simplification81.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.5e-65) (not (<= x 8.5e-37))) (* x (- 1.0 y)) (* t (- y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e-65) || !(x <= 8.5e-37)) {
tmp = x * (1.0 - y);
} else {
tmp = t * (y - 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 ((x <= (-3.5d-65)) .or. (.not. (x <= 8.5d-37))) then
tmp = x * (1.0d0 - y)
else
tmp = t * (y - z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.5e-65) || !(x <= 8.5e-37)) {
tmp = x * (1.0 - y);
} else {
tmp = t * (y - z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.5e-65) or not (x <= 8.5e-37): tmp = x * (1.0 - y) else: tmp = t * (y - z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.5e-65) || !(x <= 8.5e-37)) tmp = Float64(x * Float64(1.0 - y)); else tmp = Float64(t * Float64(y - z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.5e-65) || ~((x <= 8.5e-37))) tmp = x * (1.0 - y); else tmp = t * (y - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.5e-65], N[Not[LessEqual[x, 8.5e-37]], $MachinePrecision]], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-65} \lor \neg \left(x \leq 8.5 \cdot 10^{-37}\right):\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\end{array}
\end{array}
if x < -3.50000000000000005e-65 or 8.5000000000000007e-37 < x Initial program 100.0%
Taylor expanded in t around 0 84.0%
mul-1-neg84.0%
distribute-rgt-neg-in84.0%
sub-neg84.0%
+-commutative84.0%
distribute-neg-in84.0%
remove-double-neg84.0%
sub-neg84.0%
Simplified84.0%
Taylor expanded in z around 0 63.1%
mul-1-neg63.1%
*-rgt-identity63.1%
distribute-rgt-neg-out63.1%
distribute-lft-in63.0%
unsub-neg63.0%
Simplified63.0%
if -3.50000000000000005e-65 < x < 8.5000000000000007e-37Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 84.0%
associate-+r+84.0%
mul-1-neg84.0%
*-commutative84.0%
sub-neg84.0%
associate-+l-84.0%
*-commutative84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 75.8%
distribute-lft-out--76.7%
Simplified76.7%
Final simplification69.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.5e-20) (not (<= t 2e-119))) (* t (- y z)) (* x (- y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.5e-20) || !(t <= 2e-119)) {
tmp = t * (y - z);
} else {
tmp = x * -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 ((t <= (-1.5d-20)) .or. (.not. (t <= 2d-119))) then
tmp = t * (y - z)
else
tmp = x * -y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.5e-20) || !(t <= 2e-119)) {
tmp = t * (y - z);
} else {
tmp = x * -y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.5e-20) or not (t <= 2e-119): tmp = t * (y - z) else: tmp = x * -y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.5e-20) || !(t <= 2e-119)) tmp = Float64(t * Float64(y - z)); else tmp = Float64(x * Float64(-y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.5e-20) || ~((t <= 2e-119))) tmp = t * (y - z); else tmp = x * -y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.5e-20], N[Not[LessEqual[t, 2e-119]], $MachinePrecision]], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * (-y)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{-20} \lor \neg \left(t \leq 2 \cdot 10^{-119}\right):\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-y\right)\\
\end{array}
\end{array}
if t < -1.50000000000000014e-20 or 2.00000000000000003e-119 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in94.7%
Applied egg-rr94.7%
Taylor expanded in x around 0 76.7%
associate-+r+76.7%
mul-1-neg76.7%
*-commutative76.7%
sub-neg76.7%
associate-+l-76.7%
*-commutative76.7%
Applied egg-rr76.7%
Taylor expanded in x around 0 63.0%
distribute-lft-out--65.4%
Simplified65.4%
if -1.50000000000000014e-20 < t < 2.00000000000000003e-119Initial program 100.0%
Taylor expanded in t around 0 84.9%
mul-1-neg84.9%
distribute-rgt-neg-in84.9%
sub-neg84.9%
+-commutative84.9%
distribute-neg-in84.9%
remove-double-neg84.9%
sub-neg84.9%
Simplified84.9%
Taylor expanded in z around 0 66.8%
mul-1-neg66.8%
*-rgt-identity66.8%
distribute-rgt-neg-out66.8%
distribute-lft-in66.8%
unsub-neg66.8%
Simplified66.8%
Taylor expanded in y around inf 48.7%
mul-1-neg48.7%
*-commutative48.7%
distribute-rgt-neg-in48.7%
Simplified48.7%
Final simplification59.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.8e-65) (- x (* x y)) (if (<= x 3.9e-37) (* t (- y z)) (* x (- 1.0 y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-65) {
tmp = x - (x * y);
} else if (x <= 3.9e-37) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - 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.8d-65)) then
tmp = x - (x * y)
else if (x <= 3.9d-37) then
tmp = t * (y - z)
else
tmp = x * (1.0d0 - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.8e-65) {
tmp = x - (x * y);
} else if (x <= 3.9e-37) {
tmp = t * (y - z);
} else {
tmp = x * (1.0 - y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.8e-65: tmp = x - (x * y) elif x <= 3.9e-37: tmp = t * (y - z) else: tmp = x * (1.0 - y) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.8e-65) tmp = Float64(x - Float64(x * y)); elseif (x <= 3.9e-37) tmp = Float64(t * Float64(y - z)); else tmp = Float64(x * Float64(1.0 - y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.8e-65) tmp = x - (x * y); elseif (x <= 3.9e-37) tmp = t * (y - z); else tmp = x * (1.0 - y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.8e-65], N[(x - N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.9e-37], N[(t * N[(y - z), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.8 \cdot 10^{-65}:\\
\;\;\;\;x - x \cdot y\\
\mathbf{elif}\;x \leq 3.9 \cdot 10^{-37}:\\
\;\;\;\;t \cdot \left(y - z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\end{array}
\end{array}
if x < -2.8e-65Initial program 100.0%
Taylor expanded in y around inf 70.4%
*-commutative70.4%
Simplified70.4%
Taylor expanded in t around 0 61.9%
neg-mul-161.9%
Simplified61.9%
if -2.8e-65 < x < 3.8999999999999999e-37Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in99.1%
Applied egg-rr99.1%
Taylor expanded in x around 0 84.0%
associate-+r+84.0%
mul-1-neg84.0%
*-commutative84.0%
sub-neg84.0%
associate-+l-84.0%
*-commutative84.0%
Applied egg-rr84.0%
Taylor expanded in x around 0 75.8%
distribute-lft-out--76.7%
Simplified76.7%
if 3.8999999999999999e-37 < x Initial program 100.0%
Taylor expanded in t around 0 85.0%
mul-1-neg85.0%
distribute-rgt-neg-in85.0%
sub-neg85.0%
+-commutative85.0%
distribute-neg-in85.0%
remove-double-neg85.0%
sub-neg85.0%
Simplified85.0%
Taylor expanded in z around 0 64.5%
mul-1-neg64.5%
*-rgt-identity64.5%
distribute-rgt-neg-out64.5%
distribute-lft-in64.5%
unsub-neg64.5%
Simplified64.5%
Final simplification69.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7e+23) (not (<= z 4.9e+14))) (* x z) (* y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e+23) || !(z <= 4.9e+14)) {
tmp = x * z;
} else {
tmp = 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 <= (-7d+23)) .or. (.not. (z <= 4.9d+14))) then
tmp = x * z
else
tmp = y * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7e+23) || !(z <= 4.9e+14)) {
tmp = x * z;
} else {
tmp = y * t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7e+23) or not (z <= 4.9e+14): tmp = x * z else: tmp = y * t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7e+23) || !(z <= 4.9e+14)) tmp = Float64(x * z); else tmp = Float64(y * t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7e+23) || ~((z <= 4.9e+14))) tmp = x * z; else tmp = y * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7e+23], N[Not[LessEqual[z, 4.9e+14]], $MachinePrecision]], N[(x * z), $MachinePrecision], N[(y * t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+23} \lor \neg \left(z \leq 4.9 \cdot 10^{+14}\right):\\
\;\;\;\;x \cdot z\\
\mathbf{else}:\\
\;\;\;\;y \cdot t\\
\end{array}
\end{array}
if z < -7.0000000000000004e23 or 4.9e14 < z Initial program 100.0%
Taylor expanded in t around 0 53.5%
mul-1-neg53.5%
distribute-rgt-neg-in53.5%
sub-neg53.5%
+-commutative53.5%
distribute-neg-in53.5%
remove-double-neg53.5%
sub-neg53.5%
Simplified53.5%
Taylor expanded in z around inf 39.8%
Taylor expanded in z around inf 39.8%
if -7.0000000000000004e23 < z < 4.9e14Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 70.6%
associate-+r+70.6%
mul-1-neg70.6%
*-commutative70.6%
sub-neg70.6%
associate-+l-70.6%
*-commutative70.6%
Applied egg-rr70.6%
Taylor expanded in y around inf 34.9%
Final simplification37.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -8.4e-57) (not (<= y 0.00022))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.4e-57) || !(y <= 0.00022)) {
tmp = y * t;
} 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 ((y <= (-8.4d-57)) .or. (.not. (y <= 0.00022d0))) then
tmp = y * t
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -8.4e-57) || !(y <= 0.00022)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -8.4e-57) or not (y <= 0.00022): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -8.4e-57) || !(y <= 0.00022)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -8.4e-57) || ~((y <= 0.00022))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -8.4e-57], N[Not[LessEqual[y, 0.00022]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.4 \cdot 10^{-57} \lor \neg \left(y \leq 0.00022\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -8.3999999999999998e-57 or 2.20000000000000008e-4 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in91.7%
Applied egg-rr91.7%
Taylor expanded in x around 0 49.6%
associate-+r+49.6%
mul-1-neg49.6%
*-commutative49.6%
sub-neg49.6%
associate-+l-49.6%
*-commutative49.6%
Applied egg-rr49.6%
Taylor expanded in y around inf 37.5%
if -8.3999999999999998e-57 < y < 2.20000000000000008e-4Initial program 100.0%
Taylor expanded in y around inf 42.5%
*-commutative42.5%
Simplified42.5%
Taylor expanded in y around 0 35.9%
Final simplification36.8%
(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 inf 63.8%
*-commutative63.8%
Simplified63.8%
Taylor expanded in y around 0 17.7%
(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 2024185
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(! :herbie-platform default (+ x (+ (* t (- y z)) (* (- x) (- y z)))))
(+ x (* (- y z) (- t x))))