
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
(FPCore (x y z t) :precision binary64 (* (/ (- x y) (- z y)) t))
double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
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 - y)) * t
end function
public static double code(double x, double y, double z, double t) {
return ((x - y) / (z - y)) * t;
}
def code(x, y, z, t): return ((x - y) / (z - y)) * t
function code(x, y, z, t) return Float64(Float64(Float64(x - y) / Float64(z - y)) * t) end
function tmp = code(x, y, z, t) tmp = ((x - y) / (z - y)) * t; end
code[x_, y_, z_, t_] := N[(N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y}{z - y} \cdot t
\end{array}
Initial program 97.6%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (<= y -5e+140) (* t (/ y (- y z))) (if (<= y 3e+157) (* (- x y) (/ t (- z y))) (- t (/ t (/ y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5e+140) {
tmp = t * (y / (y - z));
} else if (y <= 3e+157) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t - (t / (y / 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 <= (-5d+140)) then
tmp = t * (y / (y - z))
else if (y <= 3d+157) then
tmp = (x - y) * (t / (z - y))
else
tmp = t - (t / (y / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5e+140) {
tmp = t * (y / (y - z));
} else if (y <= 3e+157) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t - (t / (y / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5e+140: tmp = t * (y / (y - z)) elif y <= 3e+157: tmp = (x - y) * (t / (z - y)) else: tmp = t - (t / (y / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5e+140) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 3e+157) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t - Float64(t / Float64(y / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5e+140) tmp = t * (y / (y - z)); elseif (y <= 3e+157) tmp = (x - y) * (t / (z - y)); else tmp = t - (t / (y / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5e+140], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+157], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5 \cdot 10^{+140}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 3 \cdot 10^{+157}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\end{array}
\end{array}
if y < -5.00000000000000008e140Initial program 99.9%
Taylor expanded in x around 0 93.3%
neg-mul-193.3%
distribute-neg-frac93.3%
Simplified93.3%
frac-2neg93.3%
div-inv93.1%
remove-double-neg93.1%
sub-neg93.1%
distribute-neg-in93.1%
remove-double-neg93.1%
Applied egg-rr93.1%
associate-*r/93.3%
*-rgt-identity93.3%
+-commutative93.3%
unsub-neg93.3%
Simplified93.3%
if -5.00000000000000008e140 < y < 3.0000000000000001e157Initial program 96.9%
associate-*l/92.3%
associate-*r/92.5%
Simplified92.5%
if 3.0000000000000001e157 < y Initial program 99.9%
associate-*l/78.8%
associate-*r/47.6%
Simplified47.6%
Taylor expanded in z around 0 78.8%
associate-*r/78.8%
*-commutative78.8%
neg-mul-178.8%
distribute-rgt-neg-in78.8%
Simplified78.8%
Taylor expanded in x around 0 96.9%
mul-1-neg96.9%
unsub-neg96.9%
associate-/l*99.9%
Simplified99.9%
Final simplification93.5%
(FPCore (x y z t) :precision binary64 (if (<= y -6.8e+107) t (if (<= y -5.5e+21) (* (/ x y) (- t)) (if (<= y 2e+38) (* t (/ x z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.8e+107) {
tmp = t;
} else if (y <= -5.5e+21) {
tmp = (x / y) * -t;
} else if (y <= 2e+38) {
tmp = t * (x / z);
} else {
tmp = 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.8d+107)) then
tmp = t
else if (y <= (-5.5d+21)) then
tmp = (x / y) * -t
else if (y <= 2d+38) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.8e+107) {
tmp = t;
} else if (y <= -5.5e+21) {
tmp = (x / y) * -t;
} else if (y <= 2e+38) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.8e+107: tmp = t elif y <= -5.5e+21: tmp = (x / y) * -t elif y <= 2e+38: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.8e+107) tmp = t; elseif (y <= -5.5e+21) tmp = Float64(Float64(x / y) * Float64(-t)); elseif (y <= 2e+38) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.8e+107) tmp = t; elseif (y <= -5.5e+21) tmp = (x / y) * -t; elseif (y <= 2e+38) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.8e+107], t, If[LessEqual[y, -5.5e+21], N[(N[(x / y), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[y, 2e+38], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.8 \cdot 10^{+107}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq -5.5 \cdot 10^{+21}:\\
\;\;\;\;\frac{x}{y} \cdot \left(-t\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+38}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -6.7999999999999994e107 or 1.99999999999999995e38 < y Initial program 99.9%
associate-*l/74.9%
associate-*r/65.6%
Simplified65.6%
Taylor expanded in y around inf 73.5%
if -6.7999999999999994e107 < y < -5.5e21Initial program 99.7%
associate-*l/83.8%
associate-*r/82.1%
Simplified82.1%
Taylor expanded in z around 0 44.1%
associate-*r/44.1%
*-commutative44.1%
neg-mul-144.1%
distribute-rgt-neg-in44.1%
Simplified44.1%
Taylor expanded in x around 0 44.1%
mul-1-neg44.1%
unsub-neg44.1%
associate-/l*60.3%
Simplified60.3%
Taylor expanded in y around 0 35.8%
associate-*r/51.7%
neg-mul-151.7%
distribute-lft-neg-in51.7%
*-commutative51.7%
Simplified51.7%
if -5.5e21 < y < 1.99999999999999995e38Initial program 96.0%
Taylor expanded in y around 0 65.0%
Final simplification67.1%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.9e-54) (not (<= x 22000000000000.0))) (* t (/ x (- z y))) (* t (/ y (- y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.9e-54) || !(x <= 22000000000000.0)) {
tmp = t * (x / (z - y));
} else {
tmp = t * (y / (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.9d-54)) .or. (.not. (x <= 22000000000000.0d0))) then
tmp = t * (x / (z - y))
else
tmp = t * (y / (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.9e-54) || !(x <= 22000000000000.0)) {
tmp = t * (x / (z - y));
} else {
tmp = t * (y / (y - z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.9e-54) or not (x <= 22000000000000.0): tmp = t * (x / (z - y)) else: tmp = t * (y / (y - z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.9e-54) || !(x <= 22000000000000.0)) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = Float64(t * Float64(y / Float64(y - z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.9e-54) || ~((x <= 22000000000000.0))) tmp = t * (x / (z - y)); else tmp = t * (y / (y - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.9e-54], N[Not[LessEqual[x, 22000000000000.0]], $MachinePrecision]], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.9 \cdot 10^{-54} \lor \neg \left(x \leq 22000000000000\right):\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\end{array}
\end{array}
if x < -1.9000000000000001e-54 or 2.2e13 < x Initial program 97.7%
Taylor expanded in x around inf 77.9%
if -1.9000000000000001e-54 < x < 2.2e13Initial program 97.5%
Taylor expanded in x around 0 82.2%
neg-mul-182.2%
distribute-neg-frac82.2%
Simplified82.2%
frac-2neg82.2%
div-inv82.1%
remove-double-neg82.1%
sub-neg82.1%
distribute-neg-in82.1%
remove-double-neg82.1%
Applied egg-rr82.1%
associate-*r/82.2%
*-rgt-identity82.2%
+-commutative82.2%
unsub-neg82.2%
Simplified82.2%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (<= y -2.2e+109) t (if (<= y 1.85e+41) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.2e+109) {
tmp = t;
} else if (y <= 1.85e+41) {
tmp = x * (t / (z - y));
} else {
tmp = 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 <= (-2.2d+109)) then
tmp = t
else if (y <= 1.85d+41) then
tmp = x * (t / (z - y))
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.2e+109) {
tmp = t;
} else if (y <= 1.85e+41) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.2e+109: tmp = t elif y <= 1.85e+41: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.2e+109) tmp = t; elseif (y <= 1.85e+41) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.2e+109) tmp = t; elseif (y <= 1.85e+41) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.2e+109], t, If[LessEqual[y, 1.85e+41], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{+109}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.85 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -2.1999999999999999e109 or 1.84999999999999991e41 < y Initial program 99.9%
associate-*l/74.9%
associate-*r/65.6%
Simplified65.6%
Taylor expanded in y around inf 73.5%
if -2.1999999999999999e109 < y < 1.84999999999999991e41Initial program 96.4%
associate-*l/93.7%
associate-*r/93.0%
Simplified93.0%
Taylor expanded in x around inf 74.5%
associate-*l/72.7%
*-commutative72.7%
Simplified72.7%
Final simplification73.0%
(FPCore (x y z t) :precision binary64 (if (<= y -7.2e+117) t (if (<= y 5.2e+38) (* t (/ x (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e+117) {
tmp = t;
} else if (y <= 5.2e+38) {
tmp = t * (x / (z - y));
} else {
tmp = 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 <= (-7.2d+117)) then
tmp = t
else if (y <= 5.2d+38) then
tmp = t * (x / (z - y))
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.2e+117) {
tmp = t;
} else if (y <= 5.2e+38) {
tmp = t * (x / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.2e+117: tmp = t elif y <= 5.2e+38: tmp = t * (x / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.2e+117) tmp = t; elseif (y <= 5.2e+38) tmp = Float64(t * Float64(x / Float64(z - y))); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.2e+117) tmp = t; elseif (y <= 5.2e+38) tmp = t * (x / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.2e+117], t, If[LessEqual[y, 5.2e+38], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.2 \cdot 10^{+117}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.2 \cdot 10^{+38}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -7.20000000000000025e117 or 5.1999999999999998e38 < y Initial program 99.9%
associate-*l/74.9%
associate-*r/65.6%
Simplified65.6%
Taylor expanded in y around inf 73.5%
if -7.20000000000000025e117 < y < 5.1999999999999998e38Initial program 96.4%
Taylor expanded in x around inf 75.9%
Final simplification75.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.1e-48) (/ t (/ (- z y) x)) (if (<= x 4600000000000.0) (* t (/ y (- y z))) (* t (/ x (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-48) {
tmp = t / ((z - y) / x);
} else if (x <= 4600000000000.0) {
tmp = t * (y / (y - z));
} else {
tmp = t * (x / (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 <= (-3.1d-48)) then
tmp = t / ((z - y) / x)
else if (x <= 4600000000000.0d0) then
tmp = t * (y / (y - z))
else
tmp = t * (x / (z - y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.1e-48) {
tmp = t / ((z - y) / x);
} else if (x <= 4600000000000.0) {
tmp = t * (y / (y - z));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.1e-48: tmp = t / ((z - y) / x) elif x <= 4600000000000.0: tmp = t * (y / (y - z)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.1e-48) tmp = Float64(t / Float64(Float64(z - y) / x)); elseif (x <= 4600000000000.0) tmp = Float64(t * Float64(y / Float64(y - z))); else tmp = Float64(t * Float64(x / Float64(z - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.1e-48) tmp = t / ((z - y) / x); elseif (x <= 4600000000000.0) tmp = t * (y / (y - z)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.1e-48], N[(t / N[(N[(z - y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4600000000000.0], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-48}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x}}\\
\mathbf{elif}\;x \leq 4600000000000:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if x < -3.10000000000000016e-48Initial program 97.4%
associate-*l/89.6%
associate-*r/80.2%
Simplified80.2%
associate-*r/89.6%
associate-*l/97.4%
*-commutative97.4%
clear-num97.2%
un-div-inv97.4%
Applied egg-rr97.4%
Taylor expanded in x around inf 73.6%
associate-/l*75.7%
Simplified75.7%
if -3.10000000000000016e-48 < x < 4.6e12Initial program 97.5%
Taylor expanded in x around 0 82.2%
neg-mul-182.2%
distribute-neg-frac82.2%
Simplified82.2%
frac-2neg82.2%
div-inv82.1%
remove-double-neg82.1%
sub-neg82.1%
distribute-neg-in82.1%
remove-double-neg82.1%
Applied egg-rr82.1%
associate-*r/82.2%
*-rgt-identity82.2%
+-commutative82.2%
unsub-neg82.2%
Simplified82.2%
if 4.6e12 < x Initial program 98.3%
Taylor expanded in x around inf 80.9%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (<= y -8.4e+58) t (if (<= y 1.42e+37) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.4e+58) {
tmp = t;
} else if (y <= 1.42e+37) {
tmp = x * (t / z);
} else {
tmp = 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 <= (-8.4d+58)) then
tmp = t
else if (y <= 1.42d+37) then
tmp = x * (t / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.4e+58) {
tmp = t;
} else if (y <= 1.42e+37) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.4e+58: tmp = t elif y <= 1.42e+37: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.4e+58) tmp = t; elseif (y <= 1.42e+37) tmp = Float64(x * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -8.4e+58) tmp = t; elseif (y <= 1.42e+37) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.4e+58], t, If[LessEqual[y, 1.42e+37], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.4 \cdot 10^{+58}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.42 \cdot 10^{+37}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -8.40000000000000048e58 or 1.4199999999999999e37 < y Initial program 99.8%
associate-*l/74.4%
associate-*r/66.8%
Simplified66.8%
Taylor expanded in y around inf 69.1%
if -8.40000000000000048e58 < y < 1.4199999999999999e37Initial program 96.2%
clear-num95.7%
associate-/r/96.2%
Applied egg-rr96.2%
Taylor expanded in y around 0 62.9%
associate-*l/59.4%
*-commutative59.4%
Simplified59.4%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= y -7.6e+58) t (if (<= y 8.5e+38) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.6e+58) {
tmp = t;
} else if (y <= 8.5e+38) {
tmp = t * (x / z);
} else {
tmp = 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 <= (-7.6d+58)) then
tmp = t
else if (y <= 8.5d+38) then
tmp = t * (x / z)
else
tmp = t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -7.6e+58) {
tmp = t;
} else if (y <= 8.5e+38) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -7.6e+58: tmp = t elif y <= 8.5e+38: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -7.6e+58) tmp = t; elseif (y <= 8.5e+38) tmp = Float64(t * Float64(x / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -7.6e+58) tmp = t; elseif (y <= 8.5e+38) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -7.6e+58], t, If[LessEqual[y, 8.5e+38], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{+58}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+38}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -7.5999999999999997e58 or 8.4999999999999997e38 < y Initial program 99.8%
associate-*l/74.4%
associate-*r/66.8%
Simplified66.8%
Taylor expanded in y around inf 69.1%
if -7.5999999999999997e58 < y < 8.4999999999999997e38Initial program 96.2%
Taylor expanded in y around 0 63.1%
Final simplification65.5%
(FPCore (x y z t) :precision binary64 t)
double code(double x, double y, double z, double t) {
return t;
}
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 = t
end function
public static double code(double x, double y, double z, double t) {
return t;
}
def code(x, y, z, t): return t
function code(x, y, z, t) return t end
function tmp = code(x, y, z, t) tmp = t; end
code[x_, y_, z_, t_] := t
\begin{array}{l}
\\
t
\end{array}
Initial program 97.6%
associate-*l/87.1%
associate-*r/83.4%
Simplified83.4%
Taylor expanded in y around inf 34.7%
Final simplification34.7%
(FPCore (x y z t) :precision binary64 (/ t (/ (- z y) (- x y))))
double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - 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 = t / ((z - y) / (x - y))
end function
public static double code(double x, double y, double z, double t) {
return t / ((z - y) / (x - y));
}
def code(x, y, z, t): return t / ((z - y) / (x - y))
function code(x, y, z, t) return Float64(t / Float64(Float64(z - y) / Float64(x - y))) end
function tmp = code(x, y, z, t) tmp = t / ((z - y) / (x - y)); end
code[x_, y_, z_, t_] := N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{t}{\frac{z - y}{x - y}}
\end{array}
herbie shell --seed 2023185
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:herbie-target
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))