
(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 12 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 (let* ((t_1 (/ (- x y) (- z y)))) (if (<= t_1 1e+117) (* t_1 t) (/ (* x t) (- z y)))))
double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 1e+117) {
tmp = t_1 * t;
} else {
tmp = (x * t) / (z - y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (x - y) / (z - y)
if (t_1 <= 1d+117) then
tmp = t_1 * t
else
tmp = (x * t) / (z - y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x - y) / (z - y);
double tmp;
if (t_1 <= 1e+117) {
tmp = t_1 * t;
} else {
tmp = (x * t) / (z - y);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x - y) / (z - y) tmp = 0 if t_1 <= 1e+117: tmp = t_1 * t else: tmp = (x * t) / (z - y) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x - y) / Float64(z - y)) tmp = 0.0 if (t_1 <= 1e+117) tmp = Float64(t_1 * t); else tmp = Float64(Float64(x * t) / Float64(z - y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x - y) / (z - y); tmp = 0.0; if (t_1 <= 1e+117) tmp = t_1 * t; else tmp = (x * t) / (z - y); 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, 1e+117], N[(t$95$1 * t), $MachinePrecision], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - y}{z - y}\\
\mathbf{if}\;t_1 \leq 10^{+117}:\\
\;\;\;\;t_1 \cdot t\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\end{array}
\end{array}
if (/.f64 (-.f64 x y) (-.f64 z y)) < 1.00000000000000005e117Initial program 97.5%
if 1.00000000000000005e117 < (/.f64 (-.f64 x y) (-.f64 z y)) Initial program 77.7%
associate-*l/99.9%
*-commutative99.9%
associate-*l/95.3%
Simplified95.3%
Taylor expanded in x around inf 99.9%
Final simplification97.7%
(FPCore (x y z t) :precision binary64 (if (<= y -1.75e+187) (/ (- t) (/ y (- x y))) (if (<= y 7.5e+163) (* (- x y) (/ t (- z y))) (/ t (- 1.0 (/ z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.75e+187) {
tmp = -t / (y / (x - y));
} else if (y <= 7.5e+163) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / (1.0 - (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 (y <= (-1.75d+187)) then
tmp = -t / (y / (x - y))
else if (y <= 7.5d+163) then
tmp = (x - y) * (t / (z - y))
else
tmp = t / (1.0d0 - (z / y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.75e+187) {
tmp = -t / (y / (x - y));
} else if (y <= 7.5e+163) {
tmp = (x - y) * (t / (z - y));
} else {
tmp = t / (1.0 - (z / y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.75e+187: tmp = -t / (y / (x - y)) elif y <= 7.5e+163: tmp = (x - y) * (t / (z - y)) else: tmp = t / (1.0 - (z / y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.75e+187) tmp = Float64(Float64(-t) / Float64(y / Float64(x - y))); elseif (y <= 7.5e+163) tmp = Float64(Float64(x - y) * Float64(t / Float64(z - y))); else tmp = Float64(t / Float64(1.0 - Float64(z / y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.75e+187) tmp = -t / (y / (x - y)); elseif (y <= 7.5e+163) tmp = (x - y) * (t / (z - y)); else tmp = t / (1.0 - (z / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.75e+187], N[((-t) / N[(y / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e+163], N[(N[(x - y), $MachinePrecision] * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.75 \cdot 10^{+187}:\\
\;\;\;\;\frac{-t}{\frac{y}{x - y}}\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+163}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{1 - \frac{z}{y}}\\
\end{array}
\end{array}
if y < -1.7499999999999999e187Initial program 99.8%
associate-*l/56.4%
*-commutative56.4%
associate-*l/67.6%
Simplified67.6%
Taylor expanded in z around 0 39.5%
mul-1-neg39.5%
associate-/l*83.0%
distribute-neg-frac83.0%
Simplified83.0%
if -1.7499999999999999e187 < y < 7.50000000000000001e163Initial program 94.7%
associate-*l/91.2%
*-commutative91.2%
associate-*l/91.6%
Simplified91.6%
if 7.50000000000000001e163 < y Initial program 99.9%
associate-*l/49.6%
*-commutative49.6%
associate-*l/66.5%
Simplified66.5%
Taylor expanded in x around 0 43.2%
mul-1-neg43.2%
associate-/l*86.4%
distribute-neg-frac86.4%
div-sub86.4%
*-inverses86.4%
Simplified86.4%
frac-2neg86.4%
div-inv86.4%
remove-double-neg86.4%
sub-neg86.4%
metadata-eval86.4%
distribute-neg-in86.4%
metadata-eval86.4%
Applied egg-rr86.4%
associate-*r/86.4%
*-rgt-identity86.4%
+-commutative86.4%
unsub-neg86.4%
Simplified86.4%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.2e-13) (/ (* x t) (- z y)) (if (<= x 1.8e-58) (* t (- (/ y (- z y)))) (* t (/ x (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.2e-13) {
tmp = (x * t) / (z - y);
} else if (x <= 1.8e-58) {
tmp = t * -(y / (z - y));
} 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.2d-13)) then
tmp = (x * t) / (z - y)
else if (x <= 1.8d-58) then
tmp = t * -(y / (z - y))
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.2e-13) {
tmp = (x * t) / (z - y);
} else if (x <= 1.8e-58) {
tmp = t * -(y / (z - y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.2e-13: tmp = (x * t) / (z - y) elif x <= 1.8e-58: tmp = t * -(y / (z - y)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.2e-13) tmp = Float64(Float64(x * t) / Float64(z - y)); elseif (x <= 1.8e-58) tmp = Float64(t * Float64(-Float64(y / Float64(z - y)))); 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.2e-13) tmp = (x * t) / (z - y); elseif (x <= 1.8e-58) tmp = t * -(y / (z - y)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.2e-13], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-58], N[(t * (-N[(y / N[(z - y), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-58}:\\
\;\;\;\;t \cdot \left(-\frac{y}{z - y}\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if x < -3.2e-13Initial program 93.4%
associate-*l/91.0%
*-commutative91.0%
associate-*l/87.3%
Simplified87.3%
Taylor expanded in x around inf 75.4%
if -3.2e-13 < x < 1.80000000000000005e-58Initial program 96.4%
Taylor expanded in x around 0 87.5%
neg-mul-187.5%
distribute-neg-frac87.5%
Simplified87.5%
if 1.80000000000000005e-58 < x Initial program 97.5%
Taylor expanded in x around inf 78.8%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.35e+26) (not (<= y 1.7e+18))) (- t (/ t (/ y x))) (* t (/ x (- z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e+26) || !(y <= 1.7e+18)) {
tmp = t - (t / (y / x));
} 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 ((y <= (-1.35d+26)) .or. (.not. (y <= 1.7d+18))) then
tmp = t - (t / (y / x))
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 ((y <= -1.35e+26) || !(y <= 1.7e+18)) {
tmp = t - (t / (y / x));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.35e+26) or not (y <= 1.7e+18): tmp = t - (t / (y / x)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.35e+26) || !(y <= 1.7e+18)) tmp = Float64(t - Float64(t / Float64(y / x))); 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 ((y <= -1.35e+26) || ~((y <= 1.7e+18))) tmp = t - (t / (y / x)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.35e+26], N[Not[LessEqual[y, 1.7e+18]], $MachinePrecision]], N[(t - N[(t / N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+26} \lor \neg \left(y \leq 1.7 \cdot 10^{+18}\right):\\
\;\;\;\;t - \frac{t}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if y < -1.35e26 or 1.7e18 < y Initial program 99.8%
associate-*l/66.5%
*-commutative66.5%
associate-*l/79.8%
Simplified79.8%
Taylor expanded in z around 0 58.9%
associate-*r/58.9%
neg-mul-158.9%
Simplified58.9%
Taylor expanded in y around 0 61.1%
mul-1-neg61.1%
associate-*r/70.5%
unsub-neg70.5%
associate-*r/61.1%
associate-/l*70.4%
Simplified70.4%
if -1.35e26 < y < 1.7e18Initial program 92.6%
Taylor expanded in x around inf 78.1%
Final simplification74.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.8e+29) t (if (<= y 6.8e+100) (* (- x y) (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+29) {
tmp = t;
} else if (y <= 6.8e+100) {
tmp = (x - y) * (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 <= (-1.8d+29)) then
tmp = t
else if (y <= 6.8d+100) then
tmp = (x - y) * (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 <= -1.8e+29) {
tmp = t;
} else if (y <= 6.8e+100) {
tmp = (x - y) * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e+29: tmp = t elif y <= 6.8e+100: tmp = (x - y) * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e+29) tmp = t; elseif (y <= 6.8e+100) tmp = Float64(Float64(x - y) * Float64(t / z)); else tmp = t; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.8e+29) tmp = t; elseif (y <= 6.8e+100) tmp = (x - y) * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e+29], t, If[LessEqual[y, 6.8e+100], N[(N[(x - y), $MachinePrecision] * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+29}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+100}:\\
\;\;\;\;\left(x - y\right) \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.79999999999999988e29 or 6.79999999999999988e100 < y Initial program 99.8%
associate-*l/64.2%
*-commutative64.2%
associate-*l/76.1%
Simplified76.1%
Taylor expanded in y around inf 58.8%
if -1.79999999999999988e29 < y < 6.79999999999999988e100Initial program 93.4%
associate-*l/93.8%
*-commutative93.8%
associate-*l/92.2%
Simplified92.2%
Taylor expanded in z around inf 64.5%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (if (<= y -1.9e+19) t (if (<= y 7e+73) (* x (/ t (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.9e+19) {
tmp = t;
} else if (y <= 7e+73) {
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 <= (-1.9d+19)) then
tmp = t
else if (y <= 7d+73) 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 <= -1.9e+19) {
tmp = t;
} else if (y <= 7e+73) {
tmp = x * (t / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.9e+19: tmp = t elif y <= 7e+73: tmp = x * (t / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.9e+19) tmp = t; elseif (y <= 7e+73) 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 <= -1.9e+19) tmp = t; elseif (y <= 7e+73) tmp = x * (t / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.9e+19], t, If[LessEqual[y, 7e+73], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+19}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 7 \cdot 10^{+73}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.9e19 or 7.00000000000000004e73 < y Initial program 99.8%
associate-*l/65.7%
*-commutative65.7%
associate-*l/77.7%
Simplified77.7%
Taylor expanded in y around inf 57.9%
if -1.9e19 < y < 7.00000000000000004e73Initial program 93.1%
Taylor expanded in x around inf 75.2%
*-commutative75.2%
clear-num75.1%
un-div-inv75.2%
Applied egg-rr75.2%
associate-/r/73.1%
Applied egg-rr73.1%
Final simplification66.9%
(FPCore (x y z t) :precision binary64 (if (<= y -1.8e+29) t (if (<= y 9.5e+171) (* t (/ x (- z y))) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.8e+29) {
tmp = t;
} else if (y <= 9.5e+171) {
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 <= (-1.8d+29)) then
tmp = t
else if (y <= 9.5d+171) 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 <= -1.8e+29) {
tmp = t;
} else if (y <= 9.5e+171) {
tmp = t * (x / (z - y));
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.8e+29: tmp = t elif y <= 9.5e+171: tmp = t * (x / (z - y)) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.8e+29) tmp = t; elseif (y <= 9.5e+171) 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 <= -1.8e+29) tmp = t; elseif (y <= 9.5e+171) tmp = t * (x / (z - y)); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.8e+29], t, If[LessEqual[y, 9.5e+171], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{+29}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+171}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -1.79999999999999988e29 or 9.49999999999999924e171 < y Initial program 99.8%
associate-*l/62.1%
*-commutative62.1%
associate-*l/76.4%
Simplified76.4%
Taylor expanded in y around inf 61.7%
if -1.79999999999999988e29 < y < 9.49999999999999924e171Initial program 93.9%
Taylor expanded in x around inf 71.9%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (if (<= x -1.05e-12) (* x (/ t (- z y))) (if (<= x 1.08e-57) (/ t (- 1.0 (/ z y))) (* t (/ x (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.05e-12) {
tmp = x * (t / (z - y));
} else if (x <= 1.08e-57) {
tmp = t / (1.0 - (z / y));
} 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 <= (-1.05d-12)) then
tmp = x * (t / (z - y))
else if (x <= 1.08d-57) then
tmp = t / (1.0d0 - (z / y))
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 <= -1.05e-12) {
tmp = x * (t / (z - y));
} else if (x <= 1.08e-57) {
tmp = t / (1.0 - (z / y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.05e-12: tmp = x * (t / (z - y)) elif x <= 1.08e-57: tmp = t / (1.0 - (z / y)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.05e-12) tmp = Float64(x * Float64(t / Float64(z - y))); elseif (x <= 1.08e-57) tmp = Float64(t / Float64(1.0 - Float64(z / y))); 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 <= -1.05e-12) tmp = x * (t / (z - y)); elseif (x <= 1.08e-57) tmp = t / (1.0 - (z / y)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.05e-12], N[(x * N[(t / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.08e-57], N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-12}:\\
\;\;\;\;x \cdot \frac{t}{z - y}\\
\mathbf{elif}\;x \leq 1.08 \cdot 10^{-57}:\\
\;\;\;\;\frac{t}{1 - \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if x < -1.04999999999999997e-12Initial program 93.4%
Taylor expanded in x around inf 73.0%
*-commutative73.0%
clear-num72.9%
un-div-inv73.0%
Applied egg-rr73.0%
associate-/r/73.0%
Applied egg-rr73.0%
if -1.04999999999999997e-12 < x < 1.08e-57Initial program 96.4%
associate-*l/79.4%
*-commutative79.4%
associate-*l/86.1%
Simplified86.1%
Taylor expanded in x around 0 71.6%
mul-1-neg71.6%
associate-/l*87.1%
distribute-neg-frac87.1%
div-sub87.1%
*-inverses87.1%
Simplified87.1%
frac-2neg87.1%
div-inv87.1%
remove-double-neg87.1%
sub-neg87.1%
metadata-eval87.1%
distribute-neg-in87.1%
metadata-eval87.1%
Applied egg-rr87.1%
associate-*r/87.1%
*-rgt-identity87.1%
+-commutative87.1%
unsub-neg87.1%
Simplified87.1%
if 1.08e-57 < x Initial program 97.5%
Taylor expanded in x around inf 78.8%
Final simplification80.4%
(FPCore (x y z t) :precision binary64 (if (<= x -3.85e-13) (/ (* x t) (- z y)) (if (<= x 8.5e-63) (/ t (- 1.0 (/ z y))) (* t (/ x (- z y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.85e-13) {
tmp = (x * t) / (z - y);
} else if (x <= 8.5e-63) {
tmp = t / (1.0 - (z / y));
} 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.85d-13)) then
tmp = (x * t) / (z - y)
else if (x <= 8.5d-63) then
tmp = t / (1.0d0 - (z / y))
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.85e-13) {
tmp = (x * t) / (z - y);
} else if (x <= 8.5e-63) {
tmp = t / (1.0 - (z / y));
} else {
tmp = t * (x / (z - y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.85e-13: tmp = (x * t) / (z - y) elif x <= 8.5e-63: tmp = t / (1.0 - (z / y)) else: tmp = t * (x / (z - y)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.85e-13) tmp = Float64(Float64(x * t) / Float64(z - y)); elseif (x <= 8.5e-63) tmp = Float64(t / Float64(1.0 - Float64(z / y))); 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.85e-13) tmp = (x * t) / (z - y); elseif (x <= 8.5e-63) tmp = t / (1.0 - (z / y)); else tmp = t * (x / (z - y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.85e-13], N[(N[(x * t), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-63], N[(t / N[(1.0 - N[(z / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(x / N[(z - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.85 \cdot 10^{-13}:\\
\;\;\;\;\frac{x \cdot t}{z - y}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{t}{1 - \frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{x}{z - y}\\
\end{array}
\end{array}
if x < -3.8499999999999998e-13Initial program 93.4%
associate-*l/91.0%
*-commutative91.0%
associate-*l/87.3%
Simplified87.3%
Taylor expanded in x around inf 75.4%
if -3.8499999999999998e-13 < x < 8.49999999999999969e-63Initial program 96.4%
associate-*l/79.4%
*-commutative79.4%
associate-*l/86.1%
Simplified86.1%
Taylor expanded in x around 0 71.6%
mul-1-neg71.6%
associate-/l*87.1%
distribute-neg-frac87.1%
div-sub87.1%
*-inverses87.1%
Simplified87.1%
frac-2neg87.1%
div-inv87.1%
remove-double-neg87.1%
sub-neg87.1%
metadata-eval87.1%
distribute-neg-in87.1%
metadata-eval87.1%
Applied egg-rr87.1%
associate-*r/87.1%
*-rgt-identity87.1%
+-commutative87.1%
unsub-neg87.1%
Simplified87.1%
if 8.49999999999999969e-63 < x Initial program 97.5%
Taylor expanded in x around inf 78.8%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= y -5.5e+14) t (if (<= y 1.35e-21) (* x (/ t z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.5e+14) {
tmp = t;
} else if (y <= 1.35e-21) {
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 <= (-5.5d+14)) then
tmp = t
else if (y <= 1.35d-21) 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 <= -5.5e+14) {
tmp = t;
} else if (y <= 1.35e-21) {
tmp = x * (t / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.5e+14: tmp = t elif y <= 1.35e-21: tmp = x * (t / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.5e+14) tmp = t; elseif (y <= 1.35e-21) 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 <= -5.5e+14) tmp = t; elseif (y <= 1.35e-21) tmp = x * (t / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.5e+14], t, If[LessEqual[y, 1.35e-21], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.5 \cdot 10^{+14}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-21}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -5.5e14 or 1.3500000000000001e-21 < y Initial program 99.8%
associate-*l/67.6%
*-commutative67.6%
associate-*l/80.4%
Simplified80.4%
Taylor expanded in y around inf 54.9%
if -5.5e14 < y < 1.3500000000000001e-21Initial program 92.4%
associate-*l/95.5%
*-commutative95.5%
associate-*l/91.0%
Simplified91.0%
*-commutative91.0%
clear-num91.0%
div-inv91.8%
div-inv91.7%
associate-/r*92.2%
Applied egg-rr92.2%
Taylor expanded in y around 0 59.7%
associate-*l/57.8%
Simplified57.8%
Final simplification56.4%
(FPCore (x y z t) :precision binary64 (if (<= y -6.5e+17) t (if (<= y 1.35e-21) (* t (/ x z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6.5e+17) {
tmp = t;
} else if (y <= 1.35e-21) {
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.5d+17)) then
tmp = t
else if (y <= 1.35d-21) 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.5e+17) {
tmp = t;
} else if (y <= 1.35e-21) {
tmp = t * (x / z);
} else {
tmp = t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6.5e+17: tmp = t elif y <= 1.35e-21: tmp = t * (x / z) else: tmp = t return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6.5e+17) tmp = t; elseif (y <= 1.35e-21) 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.5e+17) tmp = t; elseif (y <= 1.35e-21) tmp = t * (x / z); else tmp = t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6.5e+17], t, If[LessEqual[y, 1.35e-21], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], t]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+17}:\\
\;\;\;\;t\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-21}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\\
\end{array}
\end{array}
if y < -6.5e17 or 1.3500000000000001e-21 < y Initial program 99.8%
associate-*l/67.6%
*-commutative67.6%
associate-*l/80.4%
Simplified80.4%
Taylor expanded in y around inf 54.9%
if -6.5e17 < y < 1.3500000000000001e-21Initial program 92.4%
Taylor expanded in y around 0 61.0%
Final simplification58.1%
(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 95.8%
associate-*l/82.5%
*-commutative82.5%
associate-*l/86.1%
Simplified86.1%
Taylor expanded in y around inf 29.5%
Final simplification29.5%
(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 2023308
(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))