
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* (- y x) z) t)))
double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / 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 - x) * z) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + (((y - x) * z) / t);
}
def code(x, y, z, t): return x + (((y - x) * z) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(Float64(y - x) * z) / t)) end
function tmp = code(x, y, z, t) tmp = x + (((y - x) * z) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - x\right) \cdot z}{t}
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (- y x) (/ t z))))
double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / 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 + ((y - x) / (t / z))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) / (t / z));
}
def code(x, y, z, t): return x + ((y - x) / (t / z))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) / Float64(t / z))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) / (t / z)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - x}{\frac{t}{z}}
\end{array}
Initial program 92.5%
associate-/l*98.8%
Simplified98.8%
clear-num98.7%
un-div-inv98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))) (t_2 (/ (* y z) t)) (t_3 (* x (- 1.0 (/ z t)))))
(if (<= y -2.05e+125)
t_2
(if (<= y 4e-6)
t_3
(if (<= y 3500.0)
t_1
(if (<= y 4.4e+53)
t_3
(if (<= y 6.4e+118) t_2 (if (<= y 1.3e+216) t_3 t_1))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double t_2 = (y * z) / t;
double t_3 = x * (1.0 - (z / t));
double tmp;
if (y <= -2.05e+125) {
tmp = t_2;
} else if (y <= 4e-6) {
tmp = t_3;
} else if (y <= 3500.0) {
tmp = t_1;
} else if (y <= 4.4e+53) {
tmp = t_3;
} else if (y <= 6.4e+118) {
tmp = t_2;
} else if (y <= 1.3e+216) {
tmp = t_3;
} 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) :: t_3
real(8) :: tmp
t_1 = y * (z / t)
t_2 = (y * z) / t
t_3 = x * (1.0d0 - (z / t))
if (y <= (-2.05d+125)) then
tmp = t_2
else if (y <= 4d-6) then
tmp = t_3
else if (y <= 3500.0d0) then
tmp = t_1
else if (y <= 4.4d+53) then
tmp = t_3
else if (y <= 6.4d+118) then
tmp = t_2
else if (y <= 1.3d+216) then
tmp = t_3
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 = (y * z) / t;
double t_3 = x * (1.0 - (z / t));
double tmp;
if (y <= -2.05e+125) {
tmp = t_2;
} else if (y <= 4e-6) {
tmp = t_3;
} else if (y <= 3500.0) {
tmp = t_1;
} else if (y <= 4.4e+53) {
tmp = t_3;
} else if (y <= 6.4e+118) {
tmp = t_2;
} else if (y <= 1.3e+216) {
tmp = t_3;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) t_2 = (y * z) / t t_3 = x * (1.0 - (z / t)) tmp = 0 if y <= -2.05e+125: tmp = t_2 elif y <= 4e-6: tmp = t_3 elif y <= 3500.0: tmp = t_1 elif y <= 4.4e+53: tmp = t_3 elif y <= 6.4e+118: tmp = t_2 elif y <= 1.3e+216: tmp = t_3 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) t_2 = Float64(Float64(y * z) / t) t_3 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (y <= -2.05e+125) tmp = t_2; elseif (y <= 4e-6) tmp = t_3; elseif (y <= 3500.0) tmp = t_1; elseif (y <= 4.4e+53) tmp = t_3; elseif (y <= 6.4e+118) tmp = t_2; elseif (y <= 1.3e+216) tmp = t_3; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); t_2 = (y * z) / t; t_3 = x * (1.0 - (z / t)); tmp = 0.0; if (y <= -2.05e+125) tmp = t_2; elseif (y <= 4e-6) tmp = t_3; elseif (y <= 3500.0) tmp = t_1; elseif (y <= 4.4e+53) tmp = t_3; elseif (y <= 6.4e+118) tmp = t_2; elseif (y <= 1.3e+216) tmp = t_3; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$3 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.05e+125], t$95$2, If[LessEqual[y, 4e-6], t$95$3, If[LessEqual[y, 3500.0], t$95$1, If[LessEqual[y, 4.4e+53], t$95$3, If[LessEqual[y, 6.4e+118], t$95$2, If[LessEqual[y, 1.3e+216], t$95$3, t$95$1]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
t_2 := \frac{y \cdot z}{t}\\
t_3 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;y \leq -2.05 \cdot 10^{+125}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-6}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 3500:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.4 \cdot 10^{+53}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{+118}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.3 \cdot 10^{+216}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2.04999999999999996e125 or 4.39999999999999997e53 < y < 6.40000000000000032e118Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 64.5%
Taylor expanded in y around inf 62.6%
associate-*r/73.9%
Applied egg-rr73.9%
if -2.04999999999999996e125 < y < 3.99999999999999982e-6 or 3500 < y < 4.39999999999999997e53 or 6.40000000000000032e118 < y < 1.2999999999999999e216Initial program 92.7%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in x around inf 82.4%
mul-1-neg82.4%
unsub-neg82.4%
Simplified82.4%
if 3.99999999999999982e-6 < y < 3500 or 1.2999999999999999e216 < y Initial program 77.4%
associate-/l*99.7%
Simplified99.7%
Taylor expanded in z around inf 79.9%
Taylor expanded in y around inf 83.4%
clear-num83.4%
un-div-inv83.4%
Applied egg-rr83.4%
Taylor expanded in z around 0 67.3%
associate-*r/86.4%
*-commutative86.4%
Simplified86.4%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -5.2e-78)
t_1
(if (<= z 8.5e+34)
x
(if (or (<= z 1.15e+233) (not (<= z 1.85e+282)))
(* x (/ z (- t)))
t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -5.2e-78) {
tmp = t_1;
} else if (z <= 8.5e+34) {
tmp = x;
} else if ((z <= 1.15e+233) || !(z <= 1.85e+282)) {
tmp = x * (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 = y * (z / t)
if (z <= (-5.2d-78)) then
tmp = t_1
else if (z <= 8.5d+34) then
tmp = x
else if ((z <= 1.15d+233) .or. (.not. (z <= 1.85d+282))) then
tmp = x * (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 = y * (z / t);
double tmp;
if (z <= -5.2e-78) {
tmp = t_1;
} else if (z <= 8.5e+34) {
tmp = x;
} else if ((z <= 1.15e+233) || !(z <= 1.85e+282)) {
tmp = x * (z / -t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -5.2e-78: tmp = t_1 elif z <= 8.5e+34: tmp = x elif (z <= 1.15e+233) or not (z <= 1.85e+282): tmp = x * (z / -t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -5.2e-78) tmp = t_1; elseif (z <= 8.5e+34) tmp = x; elseif ((z <= 1.15e+233) || !(z <= 1.85e+282)) tmp = Float64(x * Float64(z / Float64(-t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -5.2e-78) tmp = t_1; elseif (z <= 8.5e+34) tmp = x; elseif ((z <= 1.15e+233) || ~((z <= 1.85e+282))) tmp = x * (z / -t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e-78], t$95$1, If[LessEqual[z, 8.5e+34], x, If[Or[LessEqual[z, 1.15e+233], N[Not[LessEqual[z, 1.85e+282]], $MachinePrecision]], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{-78}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+34}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+233} \lor \neg \left(z \leq 1.85 \cdot 10^{+282}\right):\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.2000000000000002e-78 or 1.15e233 < z < 1.8500000000000001e282Initial program 90.7%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in z around inf 74.9%
Taylor expanded in y around inf 55.2%
clear-num55.2%
un-div-inv55.2%
Applied egg-rr55.2%
Taylor expanded in z around 0 55.3%
associate-*r/60.4%
*-commutative60.4%
Simplified60.4%
if -5.2000000000000002e-78 < z < 8.5000000000000003e34Initial program 97.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 58.1%
if 8.5000000000000003e34 < z < 1.15e233 or 1.8500000000000001e282 < z Initial program 83.3%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in x around inf 74.7%
mul-1-neg74.7%
unsub-neg74.7%
Simplified74.7%
Taylor expanded in z around inf 54.7%
associate-*r/54.7%
neg-mul-154.7%
distribute-rgt-neg-in54.7%
associate-/l*58.9%
Simplified58.9%
Final simplification59.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -7.8e-79)
t_1
(if (<= z 1.35e+37)
x
(if (<= z 4.5e+234)
(* z (- (/ x t)))
(if (<= z 1.15e+284) t_1 (* x (/ z (- t)))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -7.8e-79) {
tmp = t_1;
} else if (z <= 1.35e+37) {
tmp = x;
} else if (z <= 4.5e+234) {
tmp = z * -(x / t);
} else if (z <= 1.15e+284) {
tmp = t_1;
} else {
tmp = x * (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) :: t_1
real(8) :: tmp
t_1 = y * (z / t)
if (z <= (-7.8d-79)) then
tmp = t_1
else if (z <= 1.35d+37) then
tmp = x
else if (z <= 4.5d+234) then
tmp = z * -(x / t)
else if (z <= 1.15d+284) then
tmp = t_1
else
tmp = x * (z / -t)
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 tmp;
if (z <= -7.8e-79) {
tmp = t_1;
} else if (z <= 1.35e+37) {
tmp = x;
} else if (z <= 4.5e+234) {
tmp = z * -(x / t);
} else if (z <= 1.15e+284) {
tmp = t_1;
} else {
tmp = x * (z / -t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -7.8e-79: tmp = t_1 elif z <= 1.35e+37: tmp = x elif z <= 4.5e+234: tmp = z * -(x / t) elif z <= 1.15e+284: tmp = t_1 else: tmp = x * (z / -t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -7.8e-79) tmp = t_1; elseif (z <= 1.35e+37) tmp = x; elseif (z <= 4.5e+234) tmp = Float64(z * Float64(-Float64(x / t))); elseif (z <= 1.15e+284) tmp = t_1; else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -7.8e-79) tmp = t_1; elseif (z <= 1.35e+37) tmp = x; elseif (z <= 4.5e+234) tmp = z * -(x / t); elseif (z <= 1.15e+284) tmp = t_1; else tmp = x * (z / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e-79], t$95$1, If[LessEqual[z, 1.35e+37], x, If[LessEqual[z, 4.5e+234], N[(z * (-N[(x / t), $MachinePrecision])), $MachinePrecision], If[LessEqual[z, 1.15e+284], t$95$1, N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+37}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+234}:\\
\;\;\;\;z \cdot \left(-\frac{x}{t}\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+284}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if z < -7.80000000000000011e-79 or 4.49999999999999982e234 < z < 1.14999999999999992e284Initial program 90.7%
associate-/l*98.9%
Simplified98.9%
Taylor expanded in z around inf 74.9%
Taylor expanded in y around inf 55.2%
clear-num55.2%
un-div-inv55.2%
Applied egg-rr55.2%
Taylor expanded in z around 0 55.3%
associate-*r/60.4%
*-commutative60.4%
Simplified60.4%
if -7.80000000000000011e-79 < z < 1.34999999999999993e37Initial program 97.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 58.1%
if 1.34999999999999993e37 < z < 4.49999999999999982e234Initial program 81.2%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in z around inf 82.0%
Taylor expanded in y around 0 58.5%
mul-1-neg58.5%
distribute-frac-neg258.5%
Simplified58.5%
if 1.14999999999999992e284 < z Initial program 99.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 80.0%
mul-1-neg80.0%
unsub-neg80.0%
Simplified80.0%
Taylor expanded in z around inf 79.7%
associate-*r/79.7%
neg-mul-179.7%
distribute-rgt-neg-in79.7%
associate-/l*80.0%
Simplified80.0%
Final simplification59.4%
(FPCore (x y z t) :precision binary64 (if (or (<= y -2.25e-54) (not (<= y 2e-42))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.25e-54) || !(y <= 2e-42)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (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 ((y <= (-2.25d-54)) .or. (.not. (y <= 2d-42))) then
tmp = x + (y * (z / t))
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -2.25e-54) || !(y <= 2e-42)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -2.25e-54) or not (y <= 2e-42): tmp = x + (y * (z / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -2.25e-54) || !(y <= 2e-42)) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -2.25e-54) || ~((y <= 2e-42))) tmp = x + (y * (z / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -2.25e-54], N[Not[LessEqual[y, 2e-42]], $MachinePrecision]], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.25 \cdot 10^{-54} \lor \neg \left(y \leq 2 \cdot 10^{-42}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -2.2499999999999999e-54 or 2.00000000000000008e-42 < y Initial program 94.2%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 83.8%
associate-*r/88.2%
Simplified88.2%
if -2.2499999999999999e-54 < y < 2.00000000000000008e-42Initial program 90.1%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in x around inf 89.4%
mul-1-neg89.4%
unsub-neg89.4%
Simplified89.4%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= x -1.02e-31) x (if (<= x 4.2e+53) (* z (/ y t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.02e-31) {
tmp = x;
} else if (x <= 4.2e+53) {
tmp = z * (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 (x <= (-1.02d-31)) then
tmp = x
else if (x <= 4.2d+53) then
tmp = z * (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 (x <= -1.02e-31) {
tmp = x;
} else if (x <= 4.2e+53) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.02e-31: tmp = x elif x <= 4.2e+53: tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.02e-31) tmp = x; elseif (x <= 4.2e+53) tmp = Float64(z * Float64(y / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.02e-31) tmp = x; elseif (x <= 4.2e+53) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.02e-31], x, If[LessEqual[x, 4.2e+53], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{-31}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+53}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.01999999999999999e-31 or 4.2000000000000004e53 < x Initial program 90.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 51.9%
if -1.01999999999999999e-31 < x < 4.2000000000000004e53Initial program 94.7%
associate-/l*97.6%
Simplified97.6%
Taylor expanded in z around inf 71.2%
Taylor expanded in y around inf 55.0%
Final simplification53.4%
(FPCore (x y z t) :precision binary64 (if (<= x -8.6e-30) x (if (<= x 6.2e+132) (* y (/ z t)) x)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8.6e-30) {
tmp = x;
} else if (x <= 6.2e+132) {
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 (x <= (-8.6d-30)) then
tmp = x
else if (x <= 6.2d+132) 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 (x <= -8.6e-30) {
tmp = x;
} else if (x <= 6.2e+132) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8.6e-30: tmp = x elif x <= 6.2e+132: tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8.6e-30) tmp = x; elseif (x <= 6.2e+132) tmp = Float64(y * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8.6e-30) tmp = x; elseif (x <= 6.2e+132) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8.6e-30], x, If[LessEqual[x, 6.2e+132], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.6 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{+132}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.59999999999999932e-30 or 6.1999999999999995e132 < x Initial program 91.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around 0 54.5%
if -8.59999999999999932e-30 < x < 6.1999999999999995e132Initial program 93.3%
associate-/l*97.9%
Simplified97.9%
Taylor expanded in z around inf 69.8%
Taylor expanded in y around inf 52.0%
clear-num52.0%
un-div-inv52.0%
Applied egg-rr52.0%
Taylor expanded in z around 0 54.0%
associate-*r/59.8%
*-commutative59.8%
Simplified59.8%
Final simplification57.5%
(FPCore (x y z t) :precision binary64 (+ x (* (- y x) (/ z t))))
double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / 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 - x) * (z / t))
end function
public static double code(double x, double y, double z, double t) {
return x + ((y - x) * (z / t));
}
def code(x, y, z, t): return x + ((y - x) * (z / t))
function code(x, y, z, t) return Float64(x + Float64(Float64(y - x) * Float64(z / t))) end
function tmp = code(x, y, z, t) tmp = x + ((y - x) * (z / t)); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \frac{z}{t}
\end{array}
Initial program 92.5%
associate-/l*98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t) :precision binary64 x)
double code(double x, double y, double z, double t) {
return x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x
end function
public static double code(double x, double y, double z, double t) {
return x;
}
def code(x, y, z, t): return x
function code(x, y, z, t) return x end
function tmp = code(x, y, z, t) tmp = x; end
code[x_, y_, z_, t_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.5%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in z around 0 37.0%
Final simplification37.0%
(FPCore (x y z t)
:precision binary64
(if (< x -9.025511195533005e-135)
(- x (* (/ z t) (- x y)))
(if (< x 4.275032163700715e-250)
(+ x (* (/ (- y x) t) z))
(+ x (/ (- y x) (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - 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 (x < (-9.025511195533005d-135)) then
tmp = x - ((z / t) * (x - y))
else if (x < 4.275032163700715d-250) then
tmp = x + (((y - x) / t) * z)
else
tmp = x + ((y - x) / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x < -9.025511195533005e-135) {
tmp = x - ((z / t) * (x - y));
} else if (x < 4.275032163700715e-250) {
tmp = x + (((y - x) / t) * z);
} else {
tmp = x + ((y - x) / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x < -9.025511195533005e-135: tmp = x - ((z / t) * (x - y)) elif x < 4.275032163700715e-250: tmp = x + (((y - x) / t) * z) else: tmp = x + ((y - x) / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x < -9.025511195533005e-135) tmp = Float64(x - Float64(Float64(z / t) * Float64(x - y))); elseif (x < 4.275032163700715e-250) tmp = Float64(x + Float64(Float64(Float64(y - x) / t) * z)); else tmp = Float64(x + Float64(Float64(y - x) / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x < -9.025511195533005e-135) tmp = x - ((z / t) * (x - y)); elseif (x < 4.275032163700715e-250) tmp = x + (((y - x) / t) * z); else tmp = x + ((y - x) / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Less[x, -9.025511195533005e-135], N[(x - N[(N[(z / t), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[x, 4.275032163700715e-250], N[(x + N[(N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x < -9.025511195533005 \cdot 10^{-135}:\\
\;\;\;\;x - \frac{z}{t} \cdot \left(x - y\right)\\
\mathbf{elif}\;x < 4.275032163700715 \cdot 10^{-250}:\\
\;\;\;\;x + \frac{y - x}{t} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\
\end{array}
\end{array}
herbie shell --seed 2024054
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:alt
(if (< x -9.025511195533005e-135) (- x (* (/ z t) (- x y))) (if (< x 4.275032163700715e-250) (+ x (* (/ (- y x) t) z)) (+ x (/ (- y x) (/ t z)))))
(+ x (/ (* (- y x) z) t)))