
(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 12 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
(let* ((t_1 (+ x (/ (* (- y x) z) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 4e+303)))
(+ x (/ z (/ t (- y x))))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 4e+303)) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((y - x) * z) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 4e+303)) {
tmp = x + (z / (t / (y - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((y - x) * z) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 4e+303): tmp = x + (z / (t / (y - x))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(y - x) * z) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 4e+303)) tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((y - x) * z) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 4e+303))) tmp = x + (z / (t / (y - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 4e+303]], $MachinePrecision]], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(y - x\right) \cdot z}{t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 4 \cdot 10^{+303}\right):\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 4e303 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 82.1%
associate-*l/99.9%
Simplified99.9%
*-commutative99.9%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4e303Initial program 98.9%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* z (/ y t))))
(if (<= z -4.1e+201)
t_1
(if (<= z -3.55e+28)
(* x (/ (- z) t))
(if (or (<= z -6.2e-44) (not (<= z 7.5e+15))) t_1 x)))))
double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -4.1e+201) {
tmp = t_1;
} else if (z <= -3.55e+28) {
tmp = x * (-z / t);
} else if ((z <= -6.2e-44) || !(z <= 7.5e+15)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = z * (y / t)
if (z <= (-4.1d+201)) then
tmp = t_1
else if (z <= (-3.55d+28)) then
tmp = x * (-z / t)
else if ((z <= (-6.2d-44)) .or. (.not. (z <= 7.5d+15))) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = z * (y / t);
double tmp;
if (z <= -4.1e+201) {
tmp = t_1;
} else if (z <= -3.55e+28) {
tmp = x * (-z / t);
} else if ((z <= -6.2e-44) || !(z <= 7.5e+15)) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): t_1 = z * (y / t) tmp = 0 if z <= -4.1e+201: tmp = t_1 elif z <= -3.55e+28: tmp = x * (-z / t) elif (z <= -6.2e-44) or not (z <= 7.5e+15): tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t) t_1 = Float64(z * Float64(y / t)) tmp = 0.0 if (z <= -4.1e+201) tmp = t_1; elseif (z <= -3.55e+28) tmp = Float64(x * Float64(Float64(-z) / t)); elseif ((z <= -6.2e-44) || !(z <= 7.5e+15)) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = z * (y / t); tmp = 0.0; if (z <= -4.1e+201) tmp = t_1; elseif (z <= -3.55e+28) tmp = x * (-z / t); elseif ((z <= -6.2e-44) || ~((z <= 7.5e+15))) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4.1e+201], t$95$1, If[LessEqual[z, -3.55e+28], N[(x * N[((-z) / t), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -6.2e-44], N[Not[LessEqual[z, 7.5e+15]], $MachinePrecision]], t$95$1, x]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{t}\\
\mathbf{if}\;z \leq -4.1 \cdot 10^{+201}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.55 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \frac{-z}{t}\\
\mathbf{elif}\;z \leq -6.2 \cdot 10^{-44} \lor \neg \left(z \leq 7.5 \cdot 10^{+15}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -4.1000000000000002e201 or -3.55e28 < z < -6.19999999999999968e-44 or 7.5e15 < z Initial program 87.6%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in z around inf 77.7%
Taylor expanded in y around inf 53.9%
if -4.1000000000000002e201 < z < -3.55e28Initial program 93.9%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 69.8%
mul-1-neg69.8%
unsub-neg69.8%
Simplified69.8%
Taylor expanded in z around inf 56.0%
mul-1-neg56.0%
distribute-frac-neg56.0%
Simplified56.0%
if -6.19999999999999968e-44 < z < 7.5e15Initial program 98.6%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in t around inf 61.0%
Final simplification57.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.6e-208) (not (<= x 5.8e-103))) (* x (- 1.0 (/ z t))) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e-208) || !(x <= 5.8e-103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-2.6d-208)) .or. (.not. (x <= 5.8d-103))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.6e-208) || !(x <= 5.8e-103)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.6e-208) or not (x <= 5.8e-103): tmp = x * (1.0 - (z / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.6e-208) || !(x <= 5.8e-103)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.6e-208) || ~((x <= 5.8e-103))) tmp = x * (1.0 - (z / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.6e-208], N[Not[LessEqual[x, 5.8e-103]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.6 \cdot 10^{-208} \lor \neg \left(x \leq 5.8 \cdot 10^{-103}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.60000000000000017e-208 or 5.7999999999999997e-103 < x Initial program 93.4%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in x around inf 80.7%
mul-1-neg80.7%
unsub-neg80.7%
Simplified80.7%
if -2.60000000000000017e-208 < x < 5.7999999999999997e-103Initial program 94.6%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in z around inf 72.4%
Taylor expanded in y around inf 68.5%
Final simplification77.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.2e-40) (not (<= z 2.45e-68))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.2e-40) || !(z <= 2.45e-68)) {
tmp = z * ((y - x) / 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 ((z <= (-6.2d-40)) .or. (.not. (z <= 2.45d-68))) then
tmp = z * ((y - x) / 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 ((z <= -6.2e-40) || !(z <= 2.45e-68)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.2e-40) or not (z <= 2.45e-68): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.2e-40) || !(z <= 2.45e-68)) tmp = Float64(z * Float64(Float64(y - x) / 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 ((z <= -6.2e-40) || ~((z <= 2.45e-68))) tmp = z * ((y - x) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.2e-40], N[Not[LessEqual[z, 2.45e-68]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.2 \cdot 10^{-40} \lor \neg \left(z \leq 2.45 \cdot 10^{-68}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -6.20000000000000021e-40 or 2.44999999999999988e-68 < z Initial program 90.0%
associate-/l*97.3%
Simplified97.3%
Taylor expanded in z around inf 77.9%
Taylor expanded in y around 0 77.9%
+-commutative77.9%
mul-1-neg77.9%
sub-neg77.9%
div-sub80.0%
Simplified80.0%
if -6.20000000000000021e-40 < z < 2.44999999999999988e-68Initial program 98.5%
associate-/l*99.0%
Simplified99.0%
Taylor expanded in x around inf 78.6%
mul-1-neg78.6%
unsub-neg78.6%
Simplified78.6%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -26500.0) (not (<= x 1.12e+30))) (* x (- 1.0 (/ z t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -26500.0) || !(x <= 1.12e+30)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-26500.0d0)) .or. (.not. (x <= 1.12d+30))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -26500.0) || !(x <= 1.12e+30)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -26500.0) or not (x <= 1.12e+30): tmp = x * (1.0 - (z / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -26500.0) || !(x <= 1.12e+30)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -26500.0) || ~((x <= 1.12e+30))) tmp = x * (1.0 - (z / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -26500.0], N[Not[LessEqual[x, 1.12e+30]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -26500 \lor \neg \left(x \leq 1.12 \cdot 10^{+30}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -26500 or 1.12e30 < x Initial program 92.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 88.7%
mul-1-neg88.7%
unsub-neg88.7%
Simplified88.7%
if -26500 < x < 1.12e30Initial program 95.3%
associate-*l/92.7%
Simplified92.7%
Taylor expanded in y around inf 83.2%
Final simplification85.8%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3e+23) (not (<= y 1.5e-107))) (+ x (* y (/ z t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e+23) || !(y <= 1.5e-107)) {
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 <= (-3d+23)) .or. (.not. (y <= 1.5d-107))) 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 <= -3e+23) || !(y <= 1.5e-107)) {
tmp = x + (y * (z / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3e+23) or not (y <= 1.5e-107): 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 <= -3e+23) || !(y <= 1.5e-107)) 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 <= -3e+23) || ~((y <= 1.5e-107))) 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, -3e+23], N[Not[LessEqual[y, 1.5e-107]], $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 -3 \cdot 10^{+23} \lor \neg \left(y \leq 1.5 \cdot 10^{-107}\right):\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -3.0000000000000001e23 or 1.4999999999999999e-107 < y Initial program 92.4%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in y around inf 84.0%
*-commutative84.0%
associate-/l*82.4%
Simplified82.4%
associate-/r/87.3%
Applied egg-rr87.3%
if -3.0000000000000001e23 < y < 1.4999999999999999e-107Initial program 95.3%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in x around inf 87.5%
mul-1-neg87.5%
unsub-neg87.5%
Simplified87.5%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (<= y -5.2e+24) (+ x (* y (/ z t))) (if (<= y 4e-110) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -5.2e+24) {
tmp = x + (y * (z / t));
} else if (y <= 4e-110) {
tmp = x * (1.0 - (z / t));
} 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 <= (-5.2d+24)) then
tmp = x + (y * (z / t))
else if (y <= 4d-110) then
tmp = x * (1.0d0 - (z / t))
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 <= -5.2e+24) {
tmp = x + (y * (z / t));
} else if (y <= 4e-110) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -5.2e+24: tmp = x + (y * (z / t)) elif y <= 4e-110: tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -5.2e+24) tmp = Float64(x + Float64(y * Float64(z / t))); elseif (y <= 4e-110) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -5.2e+24) tmp = x + (y * (z / t)); elseif (y <= 4e-110) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -5.2e+24], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e-110], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+24}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-110}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if y < -5.1999999999999997e24Initial program 90.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 83.0%
*-commutative83.0%
associate-/l*82.9%
Simplified82.9%
associate-/r/88.5%
Applied egg-rr88.5%
if -5.1999999999999997e24 < y < 4.0000000000000002e-110Initial program 95.3%
associate-/l*96.9%
Simplified96.9%
Taylor expanded in x around inf 87.5%
mul-1-neg87.5%
unsub-neg87.5%
Simplified87.5%
if 4.0000000000000002e-110 < y Initial program 93.5%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in y around inf 84.7%
*-commutative84.7%
associate-/l*82.1%
Simplified82.1%
associate-/r/86.6%
Applied egg-rr86.6%
*-commutative86.6%
clear-num86.5%
un-div-inv86.6%
Applied egg-rr86.6%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (<= x -6e+114) (* x (- 1.0 (/ z t))) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6e+114) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (x <= (-6d+114)) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (z * ((y - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6e+114) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6e+114: tmp = x * (1.0 - (z / t)) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6e+114) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6e+114) tmp = x * (1.0 - (z / t)); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6e+114], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+114}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if x < -6.0000000000000001e114Initial program 90.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around inf 97.6%
mul-1-neg97.6%
unsub-neg97.6%
Simplified97.6%
if -6.0000000000000001e114 < x Initial program 94.3%
associate-*l/93.1%
Simplified93.1%
Final simplification93.9%
(FPCore (x y z t) :precision binary64 (if (<= x -4.6e+162) (* x (- 1.0 (/ z t))) (+ x (/ z (/ t (- y x))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.6e+162) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z / (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 (x <= (-4.6d+162)) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (z / (t / (y - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.6e+162) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z / (t / (y - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.6e+162: tmp = x * (1.0 - (z / t)) else: tmp = x + (z / (t / (y - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.6e+162) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(z / Float64(t / Float64(y - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.6e+162) tmp = x * (1.0 - (z / t)); else tmp = x + (z / (t / (y - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.6e+162], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.6 \cdot 10^{+162}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{t}{y - x}}\\
\end{array}
\end{array}
if x < -4.59999999999999987e162Initial program 93.7%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 96.6%
mul-1-neg96.6%
unsub-neg96.6%
Simplified96.6%
if -4.59999999999999987e162 < x Initial program 93.8%
associate-*l/93.1%
Simplified93.1%
*-commutative93.1%
clear-num93.0%
un-div-inv93.9%
Applied egg-rr93.9%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e-46) (not (<= z 5.7e+16))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e-46) || !(z <= 5.7e+16)) {
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 ((z <= (-7.6d-46)) .or. (.not. (z <= 5.7d+16))) 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 ((z <= -7.6e-46) || !(z <= 5.7e+16)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e-46) or not (z <= 5.7e+16): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e-46) || !(z <= 5.7e+16)) 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 ((z <= -7.6e-46) || ~((z <= 5.7e+16))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e-46], N[Not[LessEqual[z, 5.7e+16]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{-46} \lor \neg \left(z \leq 5.7 \cdot 10^{+16}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.5999999999999993e-46 or 5.7e16 < z Initial program 89.2%
associate-/l*97.1%
Simplified97.1%
Taylor expanded in z around inf 79.0%
Taylor expanded in y around inf 51.2%
if -7.5999999999999993e-46 < z < 5.7e16Initial program 98.6%
associate-/l*99.1%
Simplified99.1%
Taylor expanded in t around inf 61.0%
Final simplification55.9%
(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 93.7%
associate-/l*98.1%
Simplified98.1%
Final simplification98.1%
(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 93.7%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in t around inf 38.0%
Final simplification38.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 2023318
(FPCore (x y z t)
:name "Numeric.Histogram:binBounds from Chart-1.5.3"
:precision binary64
:herbie-target
(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)))