
(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 1e+299)))
(+ 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+299)) {
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+299)) {
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+299): 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+299)) 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+299))) 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+299]], $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^{+299}\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.0000000000000001e299 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 85.0%
associate-*l/100.0%
Simplified100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.0000000000000001e299Initial program 99.8%
Final simplification99.9%
(FPCore (x y z t) :precision binary64 (if (<= z -2e+223) (* (/ z t) (- x)) (if (<= z -9e+66) (* z (/ y t)) (if (<= z 8e-27) x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2e+223) {
tmp = (z / t) * -x;
} else if (z <= -9e+66) {
tmp = z * (y / t);
} else if (z <= 8e-27) {
tmp = x;
} else {
tmp = 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 <= (-2d+223)) then
tmp = (z / t) * -x
else if (z <= (-9d+66)) then
tmp = z * (y / t)
else if (z <= 8d-27) then
tmp = x
else
tmp = 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 <= -2e+223) {
tmp = (z / t) * -x;
} else if (z <= -9e+66) {
tmp = z * (y / t);
} else if (z <= 8e-27) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2e+223: tmp = (z / t) * -x elif z <= -9e+66: tmp = z * (y / t) elif z <= 8e-27: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2e+223) tmp = Float64(Float64(z / t) * Float64(-x)); elseif (z <= -9e+66) tmp = Float64(z * Float64(y / t)); elseif (z <= 8e-27) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2e+223) tmp = (z / t) * -x; elseif (z <= -9e+66) tmp = z * (y / t); elseif (z <= 8e-27) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2e+223], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, -9e+66], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-27], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{+223}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -9 \cdot 10^{+66}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-27}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -2.00000000000000009e223Initial program 84.1%
*-commutative84.1%
sub-neg84.1%
distribute-lft-in75.8%
Applied egg-rr75.8%
distribute-rgt-neg-out75.8%
unsub-neg75.8%
Applied egg-rr75.8%
Taylor expanded in x around inf 83.4%
Taylor expanded in z around inf 67.7%
associate-*r/67.7%
mul-1-neg67.7%
*-commutative67.7%
distribute-rgt-neg-out67.7%
associate-*r/82.3%
Simplified82.3%
if -2.00000000000000009e223 < z < -8.9999999999999997e66Initial program 90.7%
Taylor expanded in t around 0 86.1%
Taylor expanded in y around inf 60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in z around 0 60.8%
associate-*l/67.1%
*-commutative67.1%
Simplified67.1%
if -8.9999999999999997e66 < z < 8.0000000000000003e-27Initial program 99.2%
associate-*l/88.5%
Simplified88.5%
Taylor expanded in t around inf 59.8%
if 8.0000000000000003e-27 < z Initial program 91.1%
Taylor expanded in t around 0 83.8%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
associate-/l*57.2%
associate-/r/61.9%
Applied egg-rr61.9%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (if (<= z -5e+224) (* z (/ (- x) t)) (if (<= z -1.75e+65) (* z (/ y t)) (if (<= z 2.02e-25) x (* y (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5e+224) {
tmp = z * (-x / t);
} else if (z <= -1.75e+65) {
tmp = z * (y / t);
} else if (z <= 2.02e-25) {
tmp = x;
} else {
tmp = 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 <= (-5d+224)) then
tmp = z * (-x / t)
else if (z <= (-1.75d+65)) then
tmp = z * (y / t)
else if (z <= 2.02d-25) then
tmp = x
else
tmp = 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 <= -5e+224) {
tmp = z * (-x / t);
} else if (z <= -1.75e+65) {
tmp = z * (y / t);
} else if (z <= 2.02e-25) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5e+224: tmp = z * (-x / t) elif z <= -1.75e+65: tmp = z * (y / t) elif z <= 2.02e-25: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5e+224) tmp = Float64(z * Float64(Float64(-x) / t)); elseif (z <= -1.75e+65) tmp = Float64(z * Float64(y / t)); elseif (z <= 2.02e-25) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5e+224) tmp = z * (-x / t); elseif (z <= -1.75e+65) tmp = z * (y / t); elseif (z <= 2.02e-25) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5e+224], N[(z * N[((-x) / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.75e+65], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.02e-25], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+224}:\\
\;\;\;\;z \cdot \frac{-x}{t}\\
\mathbf{elif}\;z \leq -1.75 \cdot 10^{+65}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 2.02 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.99999999999999964e224Initial program 84.1%
Taylor expanded in t around 0 84.1%
Taylor expanded in y around 0 67.7%
mul-1-neg67.7%
distribute-rgt-neg-out67.7%
Simplified67.7%
*-commutative67.7%
associate-/l*82.2%
distribute-neg-frac82.2%
associate-/r/82.4%
distribute-rgt-neg-in82.4%
Applied egg-rr82.4%
if -4.99999999999999964e224 < z < -1.75e65Initial program 90.7%
Taylor expanded in t around 0 86.1%
Taylor expanded in y around inf 60.8%
*-commutative60.8%
Simplified60.8%
Taylor expanded in z around 0 60.8%
associate-*l/67.1%
*-commutative67.1%
Simplified67.1%
if -1.75e65 < z < 2.02000000000000002e-25Initial program 99.2%
associate-*l/88.5%
Simplified88.5%
Taylor expanded in t around inf 59.8%
if 2.02000000000000002e-25 < z Initial program 91.1%
Taylor expanded in t around 0 83.8%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
associate-/l*57.2%
associate-/r/61.9%
Applied egg-rr61.9%
Final simplification62.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.06e-58) (not (<= x 1.2e-204))) (* x (- 1.0 (/ z t))) (/ (* y z) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.06e-58) || !(x <= 1.2e-204)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (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 <= (-1.06d-58)) .or. (.not. (x <= 1.2d-204))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = (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 <= -1.06e-58) || !(x <= 1.2e-204)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (y * z) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.06e-58) or not (x <= 1.2e-204): tmp = x * (1.0 - (z / t)) else: tmp = (y * z) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.06e-58) || !(x <= 1.2e-204)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(y * z) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.06e-58) || ~((x <= 1.2e-204))) tmp = x * (1.0 - (z / t)); else tmp = (y * z) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.06e-58], N[Not[LessEqual[x, 1.2e-204]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.06 \cdot 10^{-58} \lor \neg \left(x \leq 1.2 \cdot 10^{-204}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot z}{t}\\
\end{array}
\end{array}
if x < -1.0600000000000001e-58 or 1.2e-204 < x Initial program 94.7%
*-commutative94.7%
sub-neg94.7%
distribute-lft-in94.0%
Applied egg-rr94.0%
distribute-rgt-neg-out94.0%
unsub-neg94.0%
Applied egg-rr94.0%
Taylor expanded in x around inf 83.0%
if -1.0600000000000001e-58 < x < 1.2e-204Initial program 97.3%
Taylor expanded in t around 0 78.4%
Taylor expanded in y around inf 75.7%
*-commutative75.7%
Simplified75.7%
Final simplification80.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.1e-42) (not (<= x 2.2e-55))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.1e-42) || !(x <= 2.2e-55)) {
tmp = x * (1.0 - (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 <= (-2.1d-42)) .or. (.not. (x <= 2.2d-55))) then
tmp = x * (1.0d0 - (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 <= -2.1e-42) || !(x <= 2.2e-55)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.1e-42) or not (x <= 2.2e-55): tmp = x * (1.0 - (z / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.1e-42) || !(x <= 2.2e-55)) tmp = Float64(x * Float64(1.0 - 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 <= -2.1e-42) || ~((x <= 2.2e-55))) tmp = x * (1.0 - (z / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.1e-42], N[Not[LessEqual[x, 2.2e-55]], $MachinePrecision]], N[(x * N[(1.0 - 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 -2.1 \cdot 10^{-42} \lor \neg \left(x \leq 2.2 \cdot 10^{-55}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.10000000000000006e-42 or 2.2e-55 < x Initial program 94.0%
*-commutative94.0%
sub-neg94.0%
distribute-lft-in93.2%
Applied egg-rr93.2%
distribute-rgt-neg-out93.2%
unsub-neg93.2%
Applied egg-rr93.2%
Taylor expanded in x around inf 87.5%
if -2.10000000000000006e-42 < x < 2.2e-55Initial program 97.3%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in y around inf 91.5%
associate-*r/87.9%
Simplified87.9%
Final simplification87.7%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.68e-43) (not (<= x 1.95e-55))) (* x (- 1.0 (/ z t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.68e-43) || !(x <= 1.95e-55)) {
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 <= (-1.68d-43)) .or. (.not. (x <= 1.95d-55))) 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 <= -1.68e-43) || !(x <= 1.95e-55)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.68e-43) or not (x <= 1.95e-55): 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 <= -1.68e-43) || !(x <= 1.95e-55)) 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 <= -1.68e-43) || ~((x <= 1.95e-55))) 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, -1.68e-43], N[Not[LessEqual[x, 1.95e-55]], $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 -1.68 \cdot 10^{-43} \lor \neg \left(x \leq 1.95 \cdot 10^{-55}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -1.68000000000000001e-43 or 1.95e-55 < x Initial program 94.0%
*-commutative94.0%
sub-neg94.0%
distribute-lft-in93.2%
Applied egg-rr93.2%
distribute-rgt-neg-out93.2%
unsub-neg93.2%
Applied egg-rr93.2%
Taylor expanded in x around inf 87.5%
if -1.68000000000000001e-43 < x < 1.95e-55Initial program 97.3%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in y around inf 90.3%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= x -2.85e-39) (- x (/ x (/ t z))) (if (<= x 1.1e-56) (+ x (* z (/ y t))) (* x (- 1.0 (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.85e-39) {
tmp = x - (x / (t / z));
} else if (x <= 1.1e-56) {
tmp = x + (z * (y / 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 (x <= (-2.85d-39)) then
tmp = x - (x / (t / z))
else if (x <= 1.1d-56) then
tmp = x + (z * (y / 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 (x <= -2.85e-39) {
tmp = x - (x / (t / z));
} else if (x <= 1.1e-56) {
tmp = x + (z * (y / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.85e-39: tmp = x - (x / (t / z)) elif x <= 1.1e-56: tmp = x + (z * (y / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.85e-39) tmp = Float64(x - Float64(x / Float64(t / z))); elseif (x <= 1.1e-56) tmp = Float64(x + Float64(z * Float64(y / 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 (x <= -2.85e-39) tmp = x - (x / (t / z)); elseif (x <= 1.1e-56) tmp = x + (z * (y / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.85e-39], N[(x - N[(x / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.1e-56], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.85 \cdot 10^{-39}:\\
\;\;\;\;x - \frac{x}{\frac{t}{z}}\\
\mathbf{elif}\;x \leq 1.1 \cdot 10^{-56}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < -2.8499999999999998e-39Initial program 93.9%
associate-*l/90.2%
Simplified90.2%
Taylor expanded in y around 0 77.5%
neg-mul-177.5%
distribute-neg-frac77.5%
Simplified77.5%
*-commutative77.5%
add-sqr-sqrt40.1%
sqrt-unprod62.8%
sqr-neg62.8%
sqrt-unprod23.8%
add-sqr-sqrt45.9%
cancel-sign-sub-inv45.9%
add-sqr-sqrt45.9%
sqrt-unprod27.7%
sqr-neg27.7%
sqrt-unprod0.0%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
Taylor expanded in z around 0 83.6%
*-commutative83.6%
associate-/l*85.9%
Simplified85.9%
if -2.8499999999999998e-39 < x < 1.10000000000000002e-56Initial program 97.3%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in y around inf 90.3%
if 1.10000000000000002e-56 < x Initial program 94.1%
*-commutative94.1%
sub-neg94.1%
distribute-lft-in92.4%
Applied egg-rr92.4%
distribute-rgt-neg-out92.4%
unsub-neg92.4%
Applied egg-rr92.4%
Taylor expanded in x around inf 89.5%
Final simplification88.7%
(FPCore (x y z t) :precision binary64 (if (<= x 1.1e+139) (+ x (* z (/ (- y x) t))) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= 1.1e+139) {
tmp = x + (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 (x <= 1.1d+139) then
tmp = x + (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 (x <= 1.1e+139) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= 1.1e+139: tmp = x + (z * ((y - x) / t)) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= 1.1e+139) tmp = Float64(x + 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 (x <= 1.1e+139) tmp = x + (z * ((y - x) / t)); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, 1.1e+139], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.1 \cdot 10^{+139}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if x < 1.1e139Initial program 96.0%
associate-*l/93.5%
Simplified93.5%
if 1.1e139 < x Initial program 91.6%
*-commutative91.6%
sub-neg91.6%
distribute-lft-in88.2%
Applied egg-rr88.2%
distribute-rgt-neg-out88.2%
unsub-neg88.2%
Applied egg-rr88.2%
Taylor expanded in x around inf 100.0%
Final simplification94.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.8e+65) (not (<= z 1.9e-19))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.8e+65) || !(z <= 1.9e-19)) {
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 <= (-1.8d+65)) .or. (.not. (z <= 1.9d-19))) 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 <= -1.8e+65) || !(z <= 1.9e-19)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.8e+65) or not (z <= 1.9e-19): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.8e+65) || !(z <= 1.9e-19)) 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 <= -1.8e+65) || ~((z <= 1.9e-19))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.8e+65], N[Not[LessEqual[z, 1.9e-19]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.8 \cdot 10^{+65} \lor \neg \left(z \leq 1.9 \cdot 10^{-19}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.79999999999999989e65 or 1.9e-19 < z Initial program 90.2%
Taylor expanded in t around 0 84.5%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
Taylor expanded in z around 0 54.9%
associate-*l/57.5%
*-commutative57.5%
Simplified57.5%
if -1.79999999999999989e65 < z < 1.9e-19Initial program 99.2%
associate-*l/88.5%
Simplified88.5%
Taylor expanded in t around inf 59.8%
Final simplification58.9%
(FPCore (x y z t) :precision binary64 (if (<= z -4.5e+65) (* z (/ y t)) (if (<= z 2.7e-19) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -4.5e+65) {
tmp = z * (y / t);
} else if (z <= 2.7e-19) {
tmp = x;
} else {
tmp = 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.5d+65)) then
tmp = z * (y / t)
else if (z <= 2.7d-19) then
tmp = x
else
tmp = 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.5e+65) {
tmp = z * (y / t);
} else if (z <= 2.7e-19) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -4.5e+65: tmp = z * (y / t) elif z <= 2.7e-19: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -4.5e+65) tmp = Float64(z * Float64(y / t)); elseif (z <= 2.7e-19) tmp = x; else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -4.5e+65) tmp = z * (y / t); elseif (z <= 2.7e-19) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -4.5e+65], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e-19], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+65}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -4.5e65Initial program 88.9%
Taylor expanded in t around 0 85.5%
Taylor expanded in y around inf 49.3%
*-commutative49.3%
Simplified49.3%
Taylor expanded in z around 0 49.3%
associate-*l/53.8%
*-commutative53.8%
Simplified53.8%
if -4.5e65 < z < 2.7000000000000001e-19Initial program 99.2%
associate-*l/88.5%
Simplified88.5%
Taylor expanded in t around inf 59.8%
if 2.7000000000000001e-19 < z Initial program 91.1%
Taylor expanded in t around 0 83.8%
Taylor expanded in y around inf 58.7%
*-commutative58.7%
Simplified58.7%
associate-/l*57.2%
associate-/r/61.9%
Applied egg-rr61.9%
Final simplification59.3%
(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 95.5%
associate-/l*96.9%
Simplified96.9%
Final simplification96.9%
(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 95.5%
associate-*l/92.5%
Simplified92.5%
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 2023268
(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)))