
(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 (* (- 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}
Initial program 100.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (- t))))
(if (<= z -1.2e+207)
(* x z)
(if (<= z -2.9e+185)
t_1
(if (<= z -6.5e+136)
(* x z)
(if (<= z -2.5e-35)
t_1
(if (<= z -2.35e-178)
(* y t)
(if (<= z 1.05e-198)
x
(if (<= z 1.2e+16)
(* y t)
(if (<= z 5e+232) t_1 (* x z)))))))))))
double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.2e+207) {
tmp = x * z;
} else if (z <= -2.9e+185) {
tmp = t_1;
} else if (z <= -6.5e+136) {
tmp = x * z;
} else if (z <= -2.5e-35) {
tmp = t_1;
} else if (z <= -2.35e-178) {
tmp = y * t;
} else if (z <= 1.05e-198) {
tmp = x;
} else if (z <= 1.2e+16) {
tmp = y * t;
} else if (z <= 5e+232) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z * -t
if (z <= (-1.2d+207)) then
tmp = x * z
else if (z <= (-2.9d+185)) then
tmp = t_1
else if (z <= (-6.5d+136)) then
tmp = x * z
else if (z <= (-2.5d-35)) then
tmp = t_1
else if (z <= (-2.35d-178)) then
tmp = y * t
else if (z <= 1.05d-198) then
tmp = x
else if (z <= 1.2d+16) then
tmp = y * t
else if (z <= 5d+232) then
tmp = t_1
else
tmp = x * z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * -t;
double tmp;
if (z <= -1.2e+207) {
tmp = x * z;
} else if (z <= -2.9e+185) {
tmp = t_1;
} else if (z <= -6.5e+136) {
tmp = x * z;
} else if (z <= -2.5e-35) {
tmp = t_1;
} else if (z <= -2.35e-178) {
tmp = y * t;
} else if (z <= 1.05e-198) {
tmp = x;
} else if (z <= 1.2e+16) {
tmp = y * t;
} else if (z <= 5e+232) {
tmp = t_1;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * -t tmp = 0 if z <= -1.2e+207: tmp = x * z elif z <= -2.9e+185: tmp = t_1 elif z <= -6.5e+136: tmp = x * z elif z <= -2.5e-35: tmp = t_1 elif z <= -2.35e-178: tmp = y * t elif z <= 1.05e-198: tmp = x elif z <= 1.2e+16: tmp = y * t elif z <= 5e+232: tmp = t_1 else: tmp = x * z return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(-t)) tmp = 0.0 if (z <= -1.2e+207) tmp = Float64(x * z); elseif (z <= -2.9e+185) tmp = t_1; elseif (z <= -6.5e+136) tmp = Float64(x * z); elseif (z <= -2.5e-35) tmp = t_1; elseif (z <= -2.35e-178) tmp = Float64(y * t); elseif (z <= 1.05e-198) tmp = x; elseif (z <= 1.2e+16) tmp = Float64(y * t); elseif (z <= 5e+232) tmp = t_1; else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * -t; tmp = 0.0; if (z <= -1.2e+207) tmp = x * z; elseif (z <= -2.9e+185) tmp = t_1; elseif (z <= -6.5e+136) tmp = x * z; elseif (z <= -2.5e-35) tmp = t_1; elseif (z <= -2.35e-178) tmp = y * t; elseif (z <= 1.05e-198) tmp = x; elseif (z <= 1.2e+16) tmp = y * t; elseif (z <= 5e+232) tmp = t_1; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.2e+207], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.9e+185], t$95$1, If[LessEqual[z, -6.5e+136], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.5e-35], t$95$1, If[LessEqual[z, -2.35e-178], N[(y * t), $MachinePrecision], If[LessEqual[z, 1.05e-198], x, If[LessEqual[z, 1.2e+16], N[(y * t), $MachinePrecision], If[LessEqual[z, 5e+232], t$95$1, N[(x * z), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+207}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{+136}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-35}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.35 \cdot 10^{-178}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-198}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+16}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+232}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -1.2e207 or -2.89999999999999988e185 < z < -6.4999999999999998e136 or 4.99999999999999987e232 < z Initial program 100.0%
Taylor expanded in t around 0 69.0%
mul-1-neg69.0%
distribute-rgt-neg-in69.0%
sub-neg69.0%
+-commutative69.0%
distribute-neg-in69.0%
remove-double-neg69.0%
sub-neg69.0%
Simplified69.0%
Taylor expanded in y around 0 66.2%
Taylor expanded in z around inf 66.2%
*-commutative66.2%
Simplified66.2%
if -1.2e207 < z < -2.89999999999999988e185 or -6.4999999999999998e136 < z < -2.49999999999999982e-35 or 1.2e16 < z < 4.99999999999999987e232Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in94.3%
Applied egg-rr94.3%
Taylor expanded in x around 0 64.1%
Taylor expanded in x around 0 62.3%
Taylor expanded in z around inf 54.2%
mul-1-neg54.2%
distribute-rgt-neg-in54.2%
Simplified54.2%
if -2.49999999999999982e-35 < z < -2.35e-178 or 1.04999999999999996e-198 < z < 1.2e16Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 81.7%
Taylor expanded in z around 0 71.6%
+-commutative71.6%
Simplified71.6%
Taylor expanded in t around inf 56.2%
if -2.35e-178 < z < 1.04999999999999996e-198Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in x around inf 54.4%
Final simplification57.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 y))) (t_2 (* (- y z) t)))
(if (<= x -7.2e+101)
t_1
(if (<= x -1.22e+44)
t_2
(if (<= x -95000000000000.0)
t_1
(if (<= x 4.8e+46) t_2 (+ x (* x z))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = (y - z) * t;
double tmp;
if (x <= -7.2e+101) {
tmp = t_1;
} else if (x <= -1.22e+44) {
tmp = t_2;
} else if (x <= -95000000000000.0) {
tmp = t_1;
} else if (x <= 4.8e+46) {
tmp = t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * (1.0d0 - y)
t_2 = (y - z) * t
if (x <= (-7.2d+101)) then
tmp = t_1
else if (x <= (-1.22d+44)) then
tmp = t_2
else if (x <= (-95000000000000.0d0)) then
tmp = t_1
else if (x <= 4.8d+46) then
tmp = t_2
else
tmp = x + (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - y);
double t_2 = (y - z) * t;
double tmp;
if (x <= -7.2e+101) {
tmp = t_1;
} else if (x <= -1.22e+44) {
tmp = t_2;
} else if (x <= -95000000000000.0) {
tmp = t_1;
} else if (x <= 4.8e+46) {
tmp = t_2;
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - y) t_2 = (y - z) * t tmp = 0 if x <= -7.2e+101: tmp = t_1 elif x <= -1.22e+44: tmp = t_2 elif x <= -95000000000000.0: tmp = t_1 elif x <= 4.8e+46: tmp = t_2 else: tmp = x + (x * z) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - y)) t_2 = Float64(Float64(y - z) * t) tmp = 0.0 if (x <= -7.2e+101) tmp = t_1; elseif (x <= -1.22e+44) tmp = t_2; elseif (x <= -95000000000000.0) tmp = t_1; elseif (x <= 4.8e+46) tmp = t_2; else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - y); t_2 = (y - z) * t; tmp = 0.0; if (x <= -7.2e+101) tmp = t_1; elseif (x <= -1.22e+44) tmp = t_2; elseif (x <= -95000000000000.0) tmp = t_1; elseif (x <= 4.8e+46) tmp = t_2; else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[x, -7.2e+101], t$95$1, If[LessEqual[x, -1.22e+44], t$95$2, If[LessEqual[x, -95000000000000.0], t$95$1, If[LessEqual[x, 4.8e+46], t$95$2, N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - y\right)\\
t_2 := \left(y - z\right) \cdot t\\
\mathbf{if}\;x \leq -7.2 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq -1.22 \cdot 10^{+44}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \leq -95000000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+46}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if x < -7.20000000000000058e101 or -1.22e44 < x < -9.5e13Initial program 100.0%
Taylor expanded in t around 0 88.6%
mul-1-neg88.6%
distribute-rgt-neg-in88.6%
sub-neg88.6%
+-commutative88.6%
distribute-neg-in88.6%
remove-double-neg88.6%
sub-neg88.6%
Simplified88.6%
Taylor expanded in z around 0 63.8%
*-rgt-identity63.8%
mul-1-neg63.8%
distribute-rgt-neg-out63.8%
neg-mul-163.8%
distribute-lft-in63.8%
neg-mul-163.8%
unsub-neg63.8%
Simplified63.8%
if -7.20000000000000058e101 < x < -1.22e44 or -9.5e13 < x < 4.80000000000000017e46Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in98.0%
Applied egg-rr98.0%
Taylor expanded in x around 0 82.3%
Taylor expanded in x around 0 74.8%
Taylor expanded in t around 0 76.8%
neg-mul-176.8%
sub-neg76.8%
Simplified76.8%
if 4.80000000000000017e46 < x Initial program 100.0%
Taylor expanded in t around 0 85.9%
mul-1-neg85.9%
distribute-rgt-neg-in85.9%
sub-neg85.9%
+-commutative85.9%
distribute-neg-in85.9%
remove-double-neg85.9%
sub-neg85.9%
Simplified85.9%
Taylor expanded in y around 0 68.8%
Final simplification72.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- y z) t)) (t_2 (* x (- 1.0 y))))
(if (<= t -1.8e-82)
t_1
(if (<= t 9.8e-126)
t_2
(if (<= t 1.55e-65) (* x z) (if (<= t 116.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (y - z) * t;
double t_2 = x * (1.0 - y);
double tmp;
if (t <= -1.8e-82) {
tmp = t_1;
} else if (t <= 9.8e-126) {
tmp = t_2;
} else if (t <= 1.55e-65) {
tmp = x * z;
} else if (t <= 116.0) {
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 = (y - z) * t
t_2 = x * (1.0d0 - y)
if (t <= (-1.8d-82)) then
tmp = t_1
else if (t <= 9.8d-126) then
tmp = t_2
else if (t <= 1.55d-65) then
tmp = x * z
else if (t <= 116.0d0) 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 = (y - z) * t;
double t_2 = x * (1.0 - y);
double tmp;
if (t <= -1.8e-82) {
tmp = t_1;
} else if (t <= 9.8e-126) {
tmp = t_2;
} else if (t <= 1.55e-65) {
tmp = x * z;
} else if (t <= 116.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y - z) * t t_2 = x * (1.0 - y) tmp = 0 if t <= -1.8e-82: tmp = t_1 elif t <= 9.8e-126: tmp = t_2 elif t <= 1.55e-65: tmp = x * z elif t <= 116.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y - z) * t) t_2 = Float64(x * Float64(1.0 - y)) tmp = 0.0 if (t <= -1.8e-82) tmp = t_1; elseif (t <= 9.8e-126) tmp = t_2; elseif (t <= 1.55e-65) tmp = Float64(x * z); elseif (t <= 116.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y - z) * t; t_2 = x * (1.0 - y); tmp = 0.0; if (t <= -1.8e-82) tmp = t_1; elseif (t <= 9.8e-126) tmp = t_2; elseif (t <= 1.55e-65) tmp = x * z; elseif (t <= 116.0) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8e-82], t$95$1, If[LessEqual[t, 9.8e-126], t$95$2, If[LessEqual[t, 1.55e-65], N[(x * z), $MachinePrecision], If[LessEqual[t, 116.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y - z\right) \cdot t\\
t_2 := x \cdot \left(1 - y\right)\\
\mathbf{if}\;t \leq -1.8 \cdot 10^{-82}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 9.8 \cdot 10^{-126}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{-65}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;t \leq 116:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.79999999999999999e-82 or 116 < t Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in97.3%
Applied egg-rr97.3%
Taylor expanded in x around 0 83.7%
Taylor expanded in x around 0 74.1%
Taylor expanded in t around 0 76.8%
neg-mul-176.8%
sub-neg76.8%
Simplified76.8%
if -1.79999999999999999e-82 < t < 9.8000000000000002e-126 or 1.55000000000000008e-65 < t < 116Initial program 100.0%
Taylor expanded in t around 0 79.2%
mul-1-neg79.2%
distribute-rgt-neg-in79.2%
sub-neg79.2%
+-commutative79.2%
distribute-neg-in79.2%
remove-double-neg79.2%
sub-neg79.2%
Simplified79.2%
Taylor expanded in z around 0 57.0%
*-rgt-identity57.0%
mul-1-neg57.0%
distribute-rgt-neg-out57.0%
neg-mul-157.0%
distribute-lft-in57.0%
neg-mul-157.0%
unsub-neg57.0%
Simplified57.0%
if 9.8000000000000002e-126 < t < 1.55000000000000008e-65Initial program 100.0%
Taylor expanded in t around 0 78.1%
mul-1-neg78.1%
distribute-rgt-neg-in78.1%
sub-neg78.1%
+-commutative78.1%
distribute-neg-in78.1%
remove-double-neg78.1%
sub-neg78.1%
Simplified78.1%
Taylor expanded in y around 0 70.2%
Taylor expanded in z around inf 62.8%
*-commutative62.8%
Simplified62.8%
Final simplification68.7%
(FPCore (x y z t)
:precision binary64
(if (<= z -6.2e+91)
(* x z)
(if (<= z -2.8e-184)
(* y t)
(if (<= z 4.7e-200) x (if (<= z 9e+39) (* y t) (* x z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -6.2e+91) {
tmp = x * z;
} else if (z <= -2.8e-184) {
tmp = y * t;
} else if (z <= 4.7e-200) {
tmp = x;
} else if (z <= 9e+39) {
tmp = y * t;
} 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 <= (-6.2d+91)) then
tmp = x * z
else if (z <= (-2.8d-184)) then
tmp = y * t
else if (z <= 4.7d-200) then
tmp = x
else if (z <= 9d+39) then
tmp = y * t
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 <= -6.2e+91) {
tmp = x * z;
} else if (z <= -2.8e-184) {
tmp = y * t;
} else if (z <= 4.7e-200) {
tmp = x;
} else if (z <= 9e+39) {
tmp = y * t;
} else {
tmp = x * z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -6.2e+91: tmp = x * z elif z <= -2.8e-184: tmp = y * t elif z <= 4.7e-200: tmp = x elif z <= 9e+39: tmp = y * t else: tmp = x * z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -6.2e+91) tmp = Float64(x * z); elseif (z <= -2.8e-184) tmp = Float64(y * t); elseif (z <= 4.7e-200) tmp = x; elseif (z <= 9e+39) tmp = Float64(y * t); else tmp = Float64(x * z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -6.2e+91) tmp = x * z; elseif (z <= -2.8e-184) tmp = y * t; elseif (z <= 4.7e-200) tmp = x; elseif (z <= 9e+39) tmp = y * t; else tmp = x * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -6.2e+91], N[(x * z), $MachinePrecision], If[LessEqual[z, -2.8e-184], N[(y * t), $MachinePrecision], If[LessEqual[z, 4.7e-200], x, If[LessEqual[z, 9e+39], N[(y * t), $MachinePrecision], N[(x * z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{+91}:\\
\;\;\;\;x \cdot z\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-184}:\\
\;\;\;\;y \cdot t\\
\mathbf{elif}\;z \leq 4.7 \cdot 10^{-200}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+39}:\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot z\\
\end{array}
\end{array}
if z < -6.19999999999999995e91 or 8.99999999999999991e39 < z Initial program 100.0%
Taylor expanded in t around 0 52.4%
mul-1-neg52.4%
distribute-rgt-neg-in52.4%
sub-neg52.4%
+-commutative52.4%
distribute-neg-in52.4%
remove-double-neg52.4%
sub-neg52.4%
Simplified52.4%
Taylor expanded in y around 0 46.8%
Taylor expanded in z around inf 46.8%
*-commutative46.8%
Simplified46.8%
if -6.19999999999999995e91 < z < -2.7999999999999998e-184 or 4.7000000000000001e-200 < z < 8.99999999999999991e39Initial program 99.9%
*-commutative99.9%
sub-neg99.9%
distribute-lft-in98.1%
Applied egg-rr98.1%
Taylor expanded in x around 0 77.6%
Taylor expanded in z around 0 54.4%
+-commutative54.4%
Simplified54.4%
Taylor expanded in t around inf 43.3%
if -2.7999999999999998e-184 < z < 4.7000000000000001e-200Initial program 100.0%
Taylor expanded in t around inf 81.1%
Taylor expanded in x around inf 54.4%
Final simplification46.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (* z (- x t)))))
(if (<= z -1.3e-29)
t_1
(if (<= z 6.2e-101)
(+ x (* y (- t x)))
(if (<= z 1.2e+38) (+ x (* (- y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x + (z * (x - t));
double tmp;
if (z <= -1.3e-29) {
tmp = t_1;
} else if (z <= 6.2e-101) {
tmp = x + (y * (t - x));
} else if (z <= 1.2e+38) {
tmp = x + ((y - z) * t);
} 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 + (z * (x - t))
if (z <= (-1.3d-29)) then
tmp = t_1
else if (z <= 6.2d-101) then
tmp = x + (y * (t - x))
else if (z <= 1.2d+38) then
tmp = x + ((y - z) * t)
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 + (z * (x - t));
double tmp;
if (z <= -1.3e-29) {
tmp = t_1;
} else if (z <= 6.2e-101) {
tmp = x + (y * (t - x));
} else if (z <= 1.2e+38) {
tmp = x + ((y - z) * t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (z * (x - t)) tmp = 0 if z <= -1.3e-29: tmp = t_1 elif z <= 6.2e-101: tmp = x + (y * (t - x)) elif z <= 1.2e+38: tmp = x + ((y - z) * t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(z * Float64(x - t))) tmp = 0.0 if (z <= -1.3e-29) tmp = t_1; elseif (z <= 6.2e-101) tmp = Float64(x + Float64(y * Float64(t - x))); elseif (z <= 1.2e+38) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (z * (x - t)); tmp = 0.0; if (z <= -1.3e-29) tmp = t_1; elseif (z <= 6.2e-101) tmp = x + (y * (t - x)); elseif (z <= 1.2e+38) tmp = x + ((y - z) * t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(z * N[(x - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-29], t$95$1, If[LessEqual[z, 6.2e-101], N[(x + N[(y * N[(t - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+38], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + z \cdot \left(x - t\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-29}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 6.2 \cdot 10^{-101}:\\
\;\;\;\;x + y \cdot \left(t - x\right)\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+38}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.3000000000000001e-29 or 1.20000000000000009e38 < z Initial program 100.0%
Taylor expanded in y around 0 83.2%
mul-1-neg83.2%
distribute-rgt-neg-in83.2%
sub-neg83.2%
+-commutative83.2%
distribute-neg-in83.2%
remove-double-neg83.2%
sub-neg83.2%
Simplified83.2%
if -1.3000000000000001e-29 < z < 6.19999999999999946e-101Initial program 100.0%
Taylor expanded in y around inf 97.0%
*-commutative97.0%
Simplified97.0%
if 6.19999999999999946e-101 < z < 1.20000000000000009e38Initial program 100.0%
Taylor expanded in t around inf 88.8%
Final simplification89.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (- y z) -1e-47) (not (<= (- y z) 1e-46))) (* (- y z) t) x))
double code(double x, double y, double z, double t) {
double tmp;
if (((y - z) <= -1e-47) || !((y - z) <= 1e-46)) {
tmp = (y - z) * 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 - z) <= (-1d-47)) .or. (.not. ((y - z) <= 1d-46))) then
tmp = (y - z) * 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 - z) <= -1e-47) || !((y - z) <= 1e-46)) {
tmp = (y - z) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((y - z) <= -1e-47) or not ((y - z) <= 1e-46): tmp = (y - z) * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(y - z) <= -1e-47) || !(Float64(y - z) <= 1e-46)) tmp = Float64(Float64(y - z) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((y - z) <= -1e-47) || ~(((y - z) <= 1e-46))) tmp = (y - z) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(y - z), $MachinePrecision], -1e-47], N[Not[LessEqual[N[(y - z), $MachinePrecision], 1e-46]], $MachinePrecision]], N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y - z \leq -1 \cdot 10^{-47} \lor \neg \left(y - z \leq 10^{-46}\right):\\
\;\;\;\;\left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (-.f64 y z) < -9.9999999999999997e-48 or 1.00000000000000002e-46 < (-.f64 y z) Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in96.2%
Applied egg-rr96.2%
Taylor expanded in x around 0 60.9%
Taylor expanded in x around 0 58.2%
Taylor expanded in t around 0 60.0%
neg-mul-160.0%
sub-neg60.0%
Simplified60.0%
if -9.9999999999999997e-48 < (-.f64 y z) < 1.00000000000000002e-46Initial program 100.0%
Taylor expanded in t around inf 100.0%
Taylor expanded in x around inf 80.0%
Final simplification63.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.3e+101) (not (<= x 2.8e+103))) (+ x (* x (- z y))) (+ x (* (- y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e+101) || !(x <= 2.8e+103)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - 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 <= (-4.3d+101)) .or. (.not. (x <= 2.8d+103))) then
tmp = x + (x * (z - y))
else
tmp = x + ((y - z) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e+101) || !(x <= 2.8e+103)) {
tmp = x + (x * (z - y));
} else {
tmp = x + ((y - z) * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.3e+101) or not (x <= 2.8e+103): tmp = x + (x * (z - y)) else: tmp = x + ((y - z) * t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.3e+101) || !(x <= 2.8e+103)) tmp = Float64(x + Float64(x * Float64(z - y))); else tmp = Float64(x + Float64(Float64(y - z) * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.3e+101) || ~((x <= 2.8e+103))) tmp = x + (x * (z - y)); else tmp = x + ((y - z) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.3e+101], N[Not[LessEqual[x, 2.8e+103]], $MachinePrecision]], N[(x + N[(x * N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+101} \lor \neg \left(x \leq 2.8 \cdot 10^{+103}\right):\\
\;\;\;\;x + x \cdot \left(z - y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\end{array}
\end{array}
if x < -4.3000000000000001e101 or 2.80000000000000008e103 < x Initial program 100.0%
Taylor expanded in t around 0 88.1%
mul-1-neg88.1%
distribute-rgt-neg-in88.1%
sub-neg88.1%
+-commutative88.1%
distribute-neg-in88.1%
remove-double-neg88.1%
sub-neg88.1%
Simplified88.1%
if -4.3000000000000001e101 < x < 2.80000000000000008e103Initial program 100.0%
Taylor expanded in t around inf 82.6%
Final simplification84.5%
(FPCore (x y z t) :precision binary64 (if (<= x -2.5e+105) (* x (- 1.0 y)) (if (<= x 6.2e+103) (+ x (* (- y z) t)) (+ x (* x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.5e+105) {
tmp = x * (1.0 - y);
} else if (x <= 6.2e+103) {
tmp = x + ((y - z) * t);
} 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 (x <= (-2.5d+105)) then
tmp = x * (1.0d0 - y)
else if (x <= 6.2d+103) then
tmp = x + ((y - z) * t)
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 (x <= -2.5e+105) {
tmp = x * (1.0 - y);
} else if (x <= 6.2e+103) {
tmp = x + ((y - z) * t);
} else {
tmp = x + (x * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.5e+105: tmp = x * (1.0 - y) elif x <= 6.2e+103: tmp = x + ((y - z) * t) else: tmp = x + (x * z) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.5e+105) tmp = Float64(x * Float64(1.0 - y)); elseif (x <= 6.2e+103) tmp = Float64(x + Float64(Float64(y - z) * t)); else tmp = Float64(x + Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -2.5e+105) tmp = x * (1.0 - y); elseif (x <= 6.2e+103) tmp = x + ((y - z) * t); else tmp = x + (x * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.5e+105], N[(x * N[(1.0 - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.2e+103], N[(x + N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+105}:\\
\;\;\;\;x \cdot \left(1 - y\right)\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+103}:\\
\;\;\;\;x + \left(y - z\right) \cdot t\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot z\\
\end{array}
\end{array}
if x < -2.50000000000000023e105Initial program 100.0%
Taylor expanded in t around 0 86.8%
mul-1-neg86.8%
distribute-rgt-neg-in86.8%
sub-neg86.8%
+-commutative86.8%
distribute-neg-in86.8%
remove-double-neg86.8%
sub-neg86.8%
Simplified86.8%
Taylor expanded in z around 0 60.3%
*-rgt-identity60.3%
mul-1-neg60.3%
distribute-rgt-neg-out60.3%
neg-mul-160.3%
distribute-lft-in60.3%
neg-mul-160.3%
unsub-neg60.3%
Simplified60.3%
if -2.50000000000000023e105 < x < 6.2000000000000003e103Initial program 100.0%
Taylor expanded in t around inf 82.6%
if 6.2000000000000003e103 < x Initial program 100.0%
Taylor expanded in t around 0 89.5%
mul-1-neg89.5%
distribute-rgt-neg-in89.5%
sub-neg89.5%
+-commutative89.5%
distribute-neg-in89.5%
remove-double-neg89.5%
sub-neg89.5%
Simplified89.5%
Taylor expanded in y around 0 70.7%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -7.8e-18) (not (<= y 5.4e-21))) (* y t) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -7.8e-18) || !(y <= 5.4e-21)) {
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 <= (-7.8d-18)) .or. (.not. (y <= 5.4d-21))) 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 <= -7.8e-18) || !(y <= 5.4e-21)) {
tmp = y * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -7.8e-18) or not (y <= 5.4e-21): tmp = y * t else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -7.8e-18) || !(y <= 5.4e-21)) tmp = Float64(y * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -7.8e-18) || ~((y <= 5.4e-21))) tmp = y * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -7.8e-18], N[Not[LessEqual[y, 5.4e-21]], $MachinePrecision]], N[(y * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.8 \cdot 10^{-18} \lor \neg \left(y \leq 5.4 \cdot 10^{-21}\right):\\
\;\;\;\;y \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.8000000000000001e-18 or 5.4000000000000002e-21 < y Initial program 100.0%
*-commutative100.0%
sub-neg100.0%
distribute-lft-in94.1%
Applied egg-rr94.1%
Taylor expanded in x around 0 58.0%
Taylor expanded in z around 0 46.0%
+-commutative46.0%
Simplified46.0%
Taylor expanded in t around inf 45.1%
if -7.8000000000000001e-18 < y < 5.4000000000000002e-21Initial program 100.0%
Taylor expanded in t around inf 78.0%
Taylor expanded in x around inf 33.4%
Final simplification39.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 t around inf 69.0%
Taylor expanded in x around inf 17.4%
(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 2024100
(FPCore (x y z t)
:name "Data.Metrics.Snapshot:quantile from metrics-0.3.0.2"
:precision binary64
:alt
(+ x (+ (* t (- y z)) (* (- x) (- y z))))
(+ x (* (- y z) (- t x))))