
(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 10 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.0%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- y x) z) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+287)))
(+ x (* z (/ (- y x) t)))
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 <= 1e+287)) {
tmp = x + (z * ((y - x) / t));
} 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 <= 1e+287)) {
tmp = x + (z * ((y - x) / t));
} 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 <= 1e+287): tmp = x + (z * ((y - x) / t)) 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 <= 1e+287)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); 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 <= 1e+287))) tmp = x + (z * ((y - x) / t)); 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, 1e+287]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $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 10^{+287}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < -inf.0 or 1.0000000000000001e287 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 78.1%
associate-*l/99.9%
Simplified99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.0000000000000001e287Initial program 98.9%
Final simplification99.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.5e-53)
(* y (/ z t))
(if (<= z 1.8e+18)
x
(if (or (<= z 1.6e+58) (not (<= z 5e+130)))
(/ y (/ t z))
(* x (/ z (- t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e-53) {
tmp = y * (z / t);
} else if (z <= 1.8e+18) {
tmp = x;
} else if ((z <= 1.6e+58) || !(z <= 5e+130)) {
tmp = y / (t / z);
} 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) :: tmp
if (z <= (-5.5d-53)) then
tmp = y * (z / t)
else if (z <= 1.8d+18) then
tmp = x
else if ((z <= 1.6d+58) .or. (.not. (z <= 5d+130))) then
tmp = y / (t / z)
else
tmp = x * (z / -t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e-53) {
tmp = y * (z / t);
} else if (z <= 1.8e+18) {
tmp = x;
} else if ((z <= 1.6e+58) || !(z <= 5e+130)) {
tmp = y / (t / z);
} else {
tmp = x * (z / -t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e-53: tmp = y * (z / t) elif z <= 1.8e+18: tmp = x elif (z <= 1.6e+58) or not (z <= 5e+130): tmp = y / (t / z) else: tmp = x * (z / -t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e-53) tmp = Float64(y * Float64(z / t)); elseif (z <= 1.8e+18) tmp = x; elseif ((z <= 1.6e+58) || !(z <= 5e+130)) tmp = Float64(y / Float64(t / z)); else tmp = Float64(x * Float64(z / Float64(-t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.5e-53) tmp = y * (z / t); elseif (z <= 1.8e+18) tmp = x; elseif ((z <= 1.6e+58) || ~((z <= 5e+130))) tmp = y / (t / z); else tmp = x * (z / -t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e-53], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.8e+18], x, If[Or[LessEqual[z, 1.6e+58], N[Not[LessEqual[z, 5e+130]], $MachinePrecision]], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(z / (-t)), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+58} \lor \neg \left(z \leq 5 \cdot 10^{+130}\right):\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{z}{-t}\\
\end{array}
\end{array}
if z < -5.50000000000000023e-53Initial program 84.9%
Taylor expanded in t around 0 74.0%
Taylor expanded in y around inf 43.1%
*-commutative43.1%
Simplified43.1%
associate-/l*49.3%
associate-/r/53.0%
Applied egg-rr53.0%
if -5.50000000000000023e-53 < z < 1.8e18Initial program 98.6%
associate-*l/87.1%
Simplified87.1%
Taylor expanded in t around inf 65.9%
if 1.8e18 < z < 1.60000000000000008e58 or 4.9999999999999996e130 < z Initial program 87.6%
Taylor expanded in t around 0 83.4%
Taylor expanded in y around inf 64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in z around 0 64.9%
associate-/l*72.9%
Simplified72.9%
if 1.60000000000000008e58 < z < 4.9999999999999996e130Initial program 88.6%
Taylor expanded in t around 0 72.0%
Taylor expanded in y around 0 49.8%
mul-1-neg49.8%
distribute-rgt-neg-out49.8%
Simplified49.8%
associate-/l*49.9%
associate-/r/55.3%
add-sqr-sqrt30.3%
sqrt-unprod31.1%
sqr-neg31.1%
sqrt-unprod0.8%
add-sqr-sqrt2.2%
associate-/r/2.2%
frac-2neg2.2%
associate-/r/2.2%
add-sqr-sqrt1.4%
sqrt-unprod26.3%
sqr-neg26.3%
sqrt-unprod24.8%
add-sqr-sqrt55.3%
Applied egg-rr55.3%
Final simplification62.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.6e-120) (not (<= z 4.6e-128))) (+ x (* z (/ (- y x) t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.6e-120) || !(z <= 4.6e-128)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + (y * (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 <= (-4.6d-120)) .or. (.not. (z <= 4.6d-128))) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.6e-120) || !(z <= 4.6e-128)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.6e-120) or not (z <= 4.6e-128): tmp = x + (z * ((y - x) / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.6e-120) || !(z <= 4.6e-128)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.6e-120) || ~((z <= 4.6e-128))) tmp = x + (z * ((y - x) / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.6e-120], N[Not[LessEqual[z, 4.6e-128]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.6 \cdot 10^{-120} \lor \neg \left(z \leq 4.6 \cdot 10^{-128}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.59999999999999973e-120 or 4.6000000000000002e-128 < z Initial program 89.1%
associate-*l/97.8%
Simplified97.8%
if -4.59999999999999973e-120 < z < 4.6000000000000002e-128Initial program 98.4%
associate-*l/81.9%
Simplified81.9%
Taylor expanded in y around inf 93.8%
associate-*r/95.0%
Simplified95.0%
Final simplification96.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.5e-54) (not (<= z 1e-120))) (* z (/ (- y x) t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.5e-54) || !(z <= 1e-120)) {
tmp = z * ((y - x) / 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 <= (-9.5d-54)) .or. (.not. (z <= 1d-120))) then
tmp = z * ((y - x) / 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 <= -9.5e-54) || !(z <= 1e-120)) {
tmp = z * ((y - x) / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.5e-54) or not (z <= 1e-120): tmp = z * ((y - x) / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.5e-54) || !(z <= 1e-120)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.5e-54) || ~((z <= 1e-120))) tmp = z * ((y - x) / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.5e-54], N[Not[LessEqual[z, 1e-120]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{-54} \lor \neg \left(z \leq 10^{-120}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.4999999999999994e-54 or 9.99999999999999979e-121 < z Initial program 88.0%
Taylor expanded in t around 0 75.0%
associate-*l/80.4%
Applied egg-rr80.4%
if -9.4999999999999994e-54 < z < 9.99999999999999979e-121Initial program 98.7%
associate-*l/84.9%
Simplified84.9%
Taylor expanded in t around inf 73.4%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.15e+97) (not (<= z 8.5e+99))) (* z (/ (- y x) t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+97) || !(z <= 8.5e+99)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (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 <= (-1.15d+97)) .or. (.not. (z <= 8.5d+99))) then
tmp = z * ((y - x) / t)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.15e+97) || !(z <= 8.5e+99)) {
tmp = z * ((y - x) / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.15e+97) or not (z <= 8.5e+99): tmp = z * ((y - x) / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.15e+97) || !(z <= 8.5e+99)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.15e+97) || ~((z <= 8.5e+99))) tmp = z * ((y - x) / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.15e+97], N[Not[LessEqual[z, 8.5e+99]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{+97} \lor \neg \left(z \leq 8.5 \cdot 10^{+99}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -1.15000000000000003e97 or 8.49999999999999984e99 < z Initial program 86.1%
Taylor expanded in t around 0 81.1%
associate-*l/88.5%
Applied egg-rr88.5%
if -1.15000000000000003e97 < z < 8.49999999999999984e99Initial program 95.1%
associate-*l/90.8%
Simplified90.8%
Taylor expanded in y around inf 82.6%
associate-*r/85.9%
Simplified85.9%
Final simplification86.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -7.2e+18) (not (<= x 9.0))) (- x (* x (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+18) || !(x <= 9.0)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (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 ((x <= (-7.2d+18)) .or. (.not. (x <= 9.0d0))) then
tmp = x - (x * (z / t))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -7.2e+18) || !(x <= 9.0)) {
tmp = x - (x * (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -7.2e+18) or not (x <= 9.0): tmp = x - (x * (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -7.2e+18) || !(x <= 9.0)) tmp = Float64(x - Float64(x * Float64(z / t))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -7.2e+18) || ~((x <= 9.0))) tmp = x - (x * (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -7.2e+18], N[Not[LessEqual[x, 9.0]], $MachinePrecision]], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{+18} \lor \neg \left(x \leq 9\right):\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -7.2e18 or 9 < x Initial program 89.9%
associate-*l/92.1%
Simplified92.1%
Taylor expanded in y around 0 85.3%
mul-1-neg85.3%
distribute-frac-neg85.3%
*-commutative85.3%
distribute-rgt-neg-in85.3%
associate-*r/92.2%
Simplified92.2%
*-commutative92.2%
add-sqr-sqrt50.0%
sqrt-unprod66.2%
sqr-neg66.2%
sqrt-unprod22.0%
add-sqr-sqrt48.7%
frac-2neg48.7%
distribute-frac-neg48.7%
remove-double-neg48.7%
frac-2neg48.7%
cancel-sign-sub-inv48.7%
*-commutative48.7%
add-sqr-sqrt26.7%
sqrt-unprod63.8%
sqr-neg63.8%
sqrt-unprod42.1%
add-sqr-sqrt92.2%
Applied egg-rr92.2%
if -7.2e18 < x < 9Initial program 93.9%
associate-*l/93.6%
Simplified93.6%
Taylor expanded in y around inf 83.1%
associate-*r/89.2%
Simplified89.2%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2e-53) (not (<= z 1.9e+18))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2e-53) || !(z <= 1.9e+18)) {
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 ((z <= (-2d-53)) .or. (.not. (z <= 1.9d+18))) 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 ((z <= -2e-53) || !(z <= 1.9e+18)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2e-53) or not (z <= 1.9e+18): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2e-53) || !(z <= 1.9e+18)) 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 ((z <= -2e-53) || ~((z <= 1.9e+18))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2e-53], N[Not[LessEqual[z, 1.9e+18]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-53} \lor \neg \left(z \leq 1.9 \cdot 10^{+18}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.00000000000000006e-53 or 1.9e18 < z Initial program 86.3%
Taylor expanded in t around 0 76.9%
Taylor expanded in y around inf 48.2%
*-commutative48.2%
Simplified48.2%
associate-/l*52.6%
associate-/r/56.3%
Applied egg-rr56.3%
if -2.00000000000000006e-53 < z < 1.9e18Initial program 98.6%
associate-*l/87.1%
Simplified87.1%
Taylor expanded in t around inf 65.9%
Final simplification60.7%
(FPCore (x y z t) :precision binary64 (if (<= z -5.5e-53) (* y (/ z t)) (if (<= z 8e+18) x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e-53) {
tmp = y * (z / t);
} else if (z <= 8e+18) {
tmp = x;
} else {
tmp = 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 (z <= (-5.5d-53)) then
tmp = y * (z / t)
else if (z <= 8d+18) then
tmp = x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e-53) {
tmp = y * (z / t);
} else if (z <= 8e+18) {
tmp = x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e-53: tmp = y * (z / t) elif z <= 8e+18: tmp = x else: tmp = y / (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e-53) tmp = Float64(y * Float64(z / t)); elseif (z <= 8e+18) tmp = x; else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.5e-53) tmp = y * (z / t); elseif (z <= 8e+18) tmp = x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e-53], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e+18], x, N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{+18}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -5.50000000000000023e-53Initial program 84.9%
Taylor expanded in t around 0 74.0%
Taylor expanded in y around inf 43.1%
*-commutative43.1%
Simplified43.1%
associate-/l*49.3%
associate-/r/53.0%
Applied egg-rr53.0%
if -5.50000000000000023e-53 < z < 8e18Initial program 98.6%
associate-*l/87.1%
Simplified87.1%
Taylor expanded in t around inf 65.9%
if 8e18 < z Initial program 87.9%
Taylor expanded in t around 0 80.3%
Taylor expanded in y around inf 54.4%
*-commutative54.4%
Simplified54.4%
Taylor expanded in z around 0 54.4%
associate-/l*60.2%
Simplified60.2%
Final simplification60.7%
(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.0%
associate-*l/92.9%
Simplified92.9%
Taylor expanded in t around inf 39.0%
Final simplification39.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 2023274
(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)))