
(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 (if (<= (/ (- x y) (- z y)) (- INFINITY)) (* x (/ t (- z y))) (/ t (/ (- z y) (- x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x - y) / (z - y)) <= -((double) INFINITY)) {
tmp = x * (t / (z - y));
} else {
tmp = t / ((z - y) / (x - y));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x - y) / (z - y)) <= -Double.POSITIVE_INFINITY) {
tmp = x * (t / (z - y));
} else {
tmp = t / ((z - y) / (x - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x - y) / (z - y)) <= -math.inf: tmp = x * (t / (z - y)) else: tmp = t / ((z - y) / (x - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(Float64(x - y) / Float64(z - y)) <= Float64(-Inf)) tmp = Float64(x * Float64(t / Float64(z - y))); else tmp = Float64(t / Float64(Float64(z - y) / Float64(x - y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x - y) / (z - y)) <= -Inf) tmp = x * (t / (z - y)); else tmp = t / ((z - y) / (x - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], (-Infinity)], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(N[(z - y), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x - y}{z - y} \leq -\infty:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{z - y}{x - y}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -inf.0Initial program 22.4%
associate-*l/99.7%
associate-/l*99.7%
Simplified99.7%
associate-*r/99.7%
associate-*l/22.4%
*-commutative22.4%
clear-num22.4%
un-div-inv22.4%
Applied egg-rr22.4%
Taylor expanded in x around inf 22.4%
associate-/r/99.7%
Applied egg-rr99.7%
if -inf.0 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 98.1%
associate-*l/86.2%
associate-/l*84.7%
Simplified84.7%
associate-*r/86.2%
associate-*l/98.1%
*-commutative98.1%
clear-num98.0%
un-div-inv98.1%
Applied egg-rr98.1%
Final simplification98.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (- 1.0 (/ x y)))))
(if (<= y -3.6e+20)
t_1
(if (<= y -1.1e-187)
(* x (/ t (- z y)))
(if (<= y 7.5e-47) (* (- x y) (/ t z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = t * (1.0 - (x / y));
double tmp;
if (y <= -3.6e+20) {
tmp = t_1;
} else if (y <= -1.1e-187) {
tmp = x * (t / (z - y));
} else if (y <= 7.5e-47) {
tmp = (x - y) * (t / z);
} 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 = t * (1.0d0 - (x / y))
if (y <= (-3.6d+20)) then
tmp = t_1
else if (y <= (-1.1d-187)) then
tmp = x * (t / (z - y))
else if (y <= 7.5d-47) then
tmp = (x - y) * (t / z)
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 = t * (1.0 - (x / y));
double tmp;
if (y <= -3.6e+20) {
tmp = t_1;
} else if (y <= -1.1e-187) {
tmp = x * (t / (z - y));
} else if (y <= 7.5e-47) {
tmp = (x - y) * (t / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (1.0 - (x / y)) tmp = 0 if y <= -3.6e+20: tmp = t_1 elif y <= -1.1e-187: tmp = x * (t / (z - y)) elif y <= 7.5e-47: tmp = (x - y) * (t / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(1.0 - Float64(x / y))) tmp = 0.0 if (y <= -3.6e+20) tmp = t_1; elseif (y <= -1.1e-187) tmp = Float64(x * Float64(t / Float64(z - y))); elseif (y <= 7.5e-47) tmp = Float64(Float64(x - y) * Float64(t / z)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (1.0 - (x / y)); tmp = 0.0; if (y <= -3.6e+20) tmp = t_1; elseif (y <= -1.1e-187) tmp = x * (t / (z - y)); elseif (y <= 7.5e-47) tmp = (x - y) * (t / z); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.6e+20], t$95$1, If[LessEqual[y, -1.1e-187], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e-47], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+20}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-187}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-47}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.6e20 or 7.49999999999999969e-47 < y Initial program 99.9%
Taylor expanded in z around 0 78.6%
mul-1-neg78.6%
div-sub78.6%
sub-neg78.6%
*-inverses78.6%
metadata-eval78.6%
Simplified78.6%
Taylor expanded in x around 0 73.6%
*-lft-identity73.6%
associate-*r/78.6%
*-commutative78.6%
associate-*r*78.6%
distribute-rgt-in78.6%
mul-1-neg78.6%
sub-neg78.6%
Simplified78.6%
if -3.6e20 < y < -1.10000000000000004e-187Initial program 93.0%
associate-*l/92.9%
associate-/l*96.2%
Simplified96.2%
associate-*r/92.9%
associate-*l/93.0%
*-commutative93.0%
clear-num92.9%
un-div-inv93.3%
Applied egg-rr93.3%
Taylor expanded in x around inf 73.5%
associate-/r/78.7%
Applied egg-rr78.7%
if -1.10000000000000004e-187 < y < 7.49999999999999969e-47Initial program 91.9%
associate-*l/91.1%
associate-/l*94.9%
Simplified94.9%
Taylor expanded in z around inf 78.7%
*-commutative78.7%
associate-/l*82.5%
Simplified82.5%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (- x y) (- z y)))) (if (<= t_1 -4e+88) (/ (* x t) (- z y)) (* t_1 t))))
double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= -4e+88) {
tmp = (x * t) / (z - y);
} else {
tmp = t_1 * 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) / (z - y)
if (t_1 <= (-4d+88)) then
tmp = (x * t) / (z - y)
else
tmp = t_1 * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= -4e+88) {
tmp = (x * t) / (z - y);
} else {
tmp = t_1 * t;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) tmp = 0 if t_1 <= -4e+88: tmp = (x * t) / (z - y) else: tmp = t_1 * t return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) tmp = 0.0 if (t_1 <= -4e+88) tmp = Float64(Float64(x * t) / Float64(z - y)); else tmp = Float64(t_1 * t); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); tmp = 0.0; if (t_1 <= -4e+88) tmp = (x * t) / (z - y); else tmp = t_1 * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - y), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+88], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+88}:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot t\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < -3.99999999999999984e88Initial program 80.3%
associate-*l/99.8%
associate-/l*94.5%
Simplified94.5%
Taylor expanded in x around inf 99.8%
if -3.99999999999999984e88 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 98.0%
Final simplification98.2%
(FPCore (x y z t) :precision binary64 (if (<= y -2.3e+212) (* t (/ y (- y z))) (if (<= y 3.4e+141) (* (- x y) (/ t (- z y))) (* t (- 1.0 (/ x y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e+212) {
tmp = t * (y / (y - z));
} else if (y <= 3.4e+141) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (1.0 - (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 (y <= (-2.3d+212)) then
tmp = t * (y / (y - z))
else if (y <= 3.4d+141) then
tmp = (x - y) * (t / (z - y))
else
tmp = t * (1.0d0 - (x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -2.3e+212) {
tmp = t * (y / (y - z));
} else if (y <= 3.4e+141) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t * (1.0 - (x / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -2.3e+212: tmp = t * (y / (y - z)) elif y <= 3.4e+141: tmp = (x - y) * (t / (z - y)) else: tmp = t * (1.0 - (x / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -2.3e+212) tmp = Float64(t * Float64(y / Float64(y - z))); elseif (y <= 3.4e+141) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t * Float64(1.0 - Float64(x / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -2.3e+212) tmp = t * (y / (y - z)); elseif (y <= 3.4e+141) tmp = (x - y) * (t / (z - y)); else tmp = t * (1.0 - (x / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -2.3e+212], N[(t * N[(y / N[(y - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e+141], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.3 \cdot 10^{+212}:\\
\;\;\;\;t \cdot \frac{y}{y - z}\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+141}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\end{array}
\end{array}
if y < -2.2999999999999998e212Initial program 99.8%
Taylor expanded in x around 0 90.5%
neg-mul-190.5%
distribute-neg-frac290.5%
neg-sub090.5%
associate--r-90.5%
neg-sub090.5%
Simplified90.5%
Taylor expanded in t around 0 80.3%
associate-/l*90.5%
Simplified90.5%
if -2.2999999999999998e212 < y < 3.3999999999999998e141Initial program 95.3%
associate-*l/90.6%
associate-/l*92.7%
Simplified92.7%
if 3.3999999999999998e141 < y Initial program 99.9%
Taylor expanded in z around 0 97.4%
mul-1-neg97.4%
div-sub97.4%
sub-neg97.4%
*-inverses97.4%
metadata-eval97.4%
Simplified97.4%
Taylor expanded in x around 0 85.6%
*-lft-identity85.6%
associate-*r/97.4%
*-commutative97.4%
associate-*r*97.4%
distribute-rgt-in97.4%
mul-1-neg97.4%
sub-neg97.4%
Simplified97.4%
Final simplification93.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2800000000.0) (not (<= y 8.5e-105))) (* t (- 1.0 (/ x y))) (* x (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2800000000.0) || !(y <= 8.5e-105)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / 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 <= (-2800000000.0d0)) .or. (.not. (y <= 8.5d-105))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2800000000.0) || !(y <= 8.5e-105)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2800000000.0) or not (y <= 8.5e-105): tmp = t * (1.0 - (x / y)) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2800000000.0) || !(y <= 8.5e-105)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2800000000.0) || ~((y <= 8.5e-105))) tmp = t * (1.0 - (x / y)); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2800000000.0], N[Not[LessEqual[y, 8.5e-105]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2800000000 \lor \neg \left(y \leq 8.5 \cdot 10^{-105}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -2.8e9 or 8.50000000000000038e-105 < y Initial program 99.2%
Taylor expanded in z around 0 75.5%
mul-1-neg75.5%
div-sub75.5%
sub-neg75.5%
*-inverses75.5%
metadata-eval75.5%
Simplified75.5%
Taylor expanded in x around 0 71.0%
*-lft-identity71.0%
associate-*r/75.5%
*-commutative75.5%
associate-*r*75.5%
distribute-rgt-in75.5%
mul-1-neg75.5%
sub-neg75.5%
Simplified75.5%
if -2.8e9 < y < 8.50000000000000038e-105Initial program 92.2%
associate-*l/91.5%
associate-/l*95.3%
Simplified95.3%
Taylor expanded in y around 0 62.4%
*-commutative62.4%
associate-/l*66.5%
Simplified66.5%
Final simplification71.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -12500000000.0) (not (<= y 3.2e-53))) (* t (- 1.0 (/ x y))) (* (- x y) (/ t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -12500000000.0) || !(y <= 3.2e-53)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x - y) * (t / 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 <= (-12500000000.0d0)) .or. (.not. (y <= 3.2d-53))) then
tmp = t * (1.0d0 - (x / y))
else
tmp = (x - y) * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -12500000000.0) || !(y <= 3.2e-53)) {
tmp = t * (1.0 - (x / y));
} else {
tmp = (x - y) * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -12500000000.0) or not (y <= 3.2e-53): tmp = t * (1.0 - (x / y)) else: tmp = (x - y) * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -12500000000.0) || !(y <= 3.2e-53)) tmp = Float64(t * Float64(1.0 - Float64(x / y))); else tmp = Float64(Float64(x - y) * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -12500000000.0) || ~((y <= 3.2e-53))) tmp = t * (1.0 - (x / y)); else tmp = (x - y) * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -12500000000.0], N[Not[LessEqual[y, 3.2e-53]], $MachinePrecision]], N[(t * N[(1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -12500000000 \lor \neg \left(y \leq 3.2 \cdot 10^{-53}\right):\\
\;\;\;\;t \cdot \left(1 - \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\end{array}
\end{array}
if y < -1.25e10 or 3.2000000000000001e-53 < y Initial program 99.9%
Taylor expanded in z around 0 77.8%
mul-1-neg77.8%
div-sub77.9%
sub-neg77.9%
*-inverses77.9%
metadata-eval77.9%
Simplified77.9%
Taylor expanded in x around 0 73.0%
*-lft-identity73.0%
associate-*r/77.9%
*-commutative77.9%
associate-*r*77.9%
distribute-rgt-in77.9%
mul-1-neg77.9%
sub-neg77.9%
Simplified77.9%
if -1.25e10 < y < 3.2000000000000001e-53Initial program 92.0%
associate-*l/91.4%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in z around inf 73.8%
*-commutative73.8%
associate-/l*77.1%
Simplified77.1%
Final simplification77.5%
(FPCore (x y z t) :precision binary64 (if (<= y -8.2e+20) t (if (<= y 2e-25) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.2e+20) {
tmp = t;
} else if (y <= 2e-25) {
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.2d+20)) then
tmp = t
else if (y <= 2d-25) 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.2e+20) {
tmp = t;
} else if (y <= 2e-25) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.2e+20: tmp = t elif y <= 2e-25: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.2e+20) tmp = t; elseif (y <= 2e-25) 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.2e+20) tmp = t; elseif (y <= 2e-25) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.2e+20], t, If[LessEqual[y, 2e-25], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{+20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 2 \cdot 10^{-25}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -8.2e20 or 2.00000000000000008e-25 < y Initial program 99.9%
associate-*l/80.9%
associate-/l*74.6%
Simplified74.6%
Taylor expanded in y around inf 62.6%
if -8.2e20 < y < 2.00000000000000008e-25Initial program 92.7%
associate-*l/92.2%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in y around 0 57.9%
*-commutative57.9%
associate-/l*60.9%
Simplified60.9%
Final simplification61.8%
(FPCore (x y z t) :precision binary64 (if (<= y -9.5e+20) t (if (<= y 5.8e-27) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.5e+20) {
tmp = t;
} else if (y <= 5.8e-27) {
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 <= (-9.5d+20)) then
tmp = t
else if (y <= 5.8d-27) 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 <= -9.5e+20) {
tmp = t;
} else if (y <= 5.8e-27) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.5e+20: tmp = t elif y <= 5.8e-27: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.5e+20) tmp = t; elseif (y <= 5.8e-27) 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 <= -9.5e+20) tmp = t; elseif (y <= 5.8e-27) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.5e+20], t, If[LessEqual[y, 5.8e-27], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{-27}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -9.5e20 or 5.80000000000000008e-27 < y Initial program 99.9%
associate-*l/80.9%
associate-/l*74.6%
Simplified74.6%
Taylor expanded in y around inf 62.6%
if -9.5e20 < y < 5.80000000000000008e-27Initial program 92.7%
Taylor expanded in y around 0 61.1%
Final simplification61.9%
(FPCore (x y z t) :precision binary64 (if (<= y -6.2e+20) t (if (<= y 1.9e-25) (/ t (/ z x)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.2e+20) {
tmp = t;
} else if (y <= 1.9e-25) {
tmp = t / (z / x);
} 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.2d+20)) then
tmp = t
else if (y <= 1.9d-25) then
tmp = t / (z / x)
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.2e+20) {
tmp = t;
} else if (y <= 1.9e-25) {
tmp = t / (z / x);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.2e+20: tmp = t elif y <= 1.9e-25: tmp = t / (z / x) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.2e+20) tmp = t; elseif (y <= 1.9e-25) tmp = Float64(t / Float64(z / x)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -6.2e+20) tmp = t; elseif (y <= 1.9e-25) tmp = t / (z / x); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.2e+20], t, If[LessEqual[y, 1.9e-25], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{+20}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{-25}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -6.2e20 or 1.8999999999999999e-25 < y Initial program 99.9%
associate-*l/80.9%
associate-/l*74.6%
Simplified74.6%
Taylor expanded in y around inf 62.6%
if -6.2e20 < y < 1.8999999999999999e-25Initial program 92.7%
associate-*l/92.2%
associate-/l*95.6%
Simplified95.6%
associate-*r/92.2%
associate-*l/92.7%
*-commutative92.7%
clear-num92.7%
un-div-inv92.9%
Applied egg-rr92.9%
Taylor expanded in y around 0 61.1%
Final simplification61.9%
(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 96.3%
associate-*l/86.5%
associate-/l*85.0%
Simplified85.0%
Taylor expanded in y around inf 36.7%
Final simplification36.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 2024089
(FPCore (x y z t)
:name "Numeric.Signal.Multichannel:$cput from hsignal-0.2.7.1"
:precision binary64
:alt
(/ t (/ (- z y) (- x y)))
(* (/ (- x y) (- z y)) t))