
(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 13 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 (/ (* z (- y x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+291)))
(+ x (* z (/ (- y x) t)))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+291)) {
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 + ((z * (y - x)) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+291)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + ((z * (y - x)) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+291): tmp = x + (z * ((y - x) / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(z * Float64(y - x)) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+291)) 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 + ((z * (y - x)) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+291))) 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[(z * N[(y - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+291]], $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{z \cdot \left(y - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+291}\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.9999999999999999e291 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 83.3%
associate-*l/100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 1.9999999999999999e291Initial program 99.2%
Final simplification99.5%
(FPCore (x y z t) :precision binary64 (fma (/ z t) (- y x) x))
double code(double x, double y, double z, double t) {
return fma((z / t), (y - x), x);
}
function code(x, y, z, t) return fma(Float64(z / t), Float64(y - x), x) end
code[x_, y_, z_, t_] := N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z}{t}, y - x, x\right)
\end{array}
Initial program 93.5%
+-commutative93.5%
*-commutative93.5%
associate-*l/98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) y)) (t_2 (* z (/ x (- t)))))
(if (<= z -3.4e+181)
t_1
(if (<= z -4.2e+158)
t_2
(if (<= z -4.8e+28)
(* z (/ y t))
(if (<= z 4.5e-20)
x
(if (<= z 4.3e+76)
t_1
(if (<= z 1.95e+99)
x
(if (or (<= z 5e+221) (not (<= z 8e+272))) t_1 t_2)))))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double t_2 = z * (x / -t);
double tmp;
if (z <= -3.4e+181) {
tmp = t_1;
} else if (z <= -4.2e+158) {
tmp = t_2;
} else if (z <= -4.8e+28) {
tmp = z * (y / t);
} else if (z <= 4.5e-20) {
tmp = x;
} else if (z <= 4.3e+76) {
tmp = t_1;
} else if (z <= 1.95e+99) {
tmp = x;
} else if ((z <= 5e+221) || !(z <= 8e+272)) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: tmp
t_1 = (z / t) * y
t_2 = z * (x / -t)
if (z <= (-3.4d+181)) then
tmp = t_1
else if (z <= (-4.2d+158)) then
tmp = t_2
else if (z <= (-4.8d+28)) then
tmp = z * (y / t)
else if (z <= 4.5d-20) then
tmp = x
else if (z <= 4.3d+76) then
tmp = t_1
else if (z <= 1.95d+99) then
tmp = x
else if ((z <= 5d+221) .or. (.not. (z <= 8d+272))) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double t_2 = z * (x / -t);
double tmp;
if (z <= -3.4e+181) {
tmp = t_1;
} else if (z <= -4.2e+158) {
tmp = t_2;
} else if (z <= -4.8e+28) {
tmp = z * (y / t);
} else if (z <= 4.5e-20) {
tmp = x;
} else if (z <= 4.3e+76) {
tmp = t_1;
} else if (z <= 1.95e+99) {
tmp = x;
} else if ((z <= 5e+221) || !(z <= 8e+272)) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * y t_2 = z * (x / -t) tmp = 0 if z <= -3.4e+181: tmp = t_1 elif z <= -4.2e+158: tmp = t_2 elif z <= -4.8e+28: tmp = z * (y / t) elif z <= 4.5e-20: tmp = x elif z <= 4.3e+76: tmp = t_1 elif z <= 1.95e+99: tmp = x elif (z <= 5e+221) or not (z <= 8e+272): tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * y) t_2 = Float64(z * Float64(x / Float64(-t))) tmp = 0.0 if (z <= -3.4e+181) tmp = t_1; elseif (z <= -4.2e+158) tmp = t_2; elseif (z <= -4.8e+28) tmp = Float64(z * Float64(y / t)); elseif (z <= 4.5e-20) tmp = x; elseif (z <= 4.3e+76) tmp = t_1; elseif (z <= 1.95e+99) tmp = x; elseif ((z <= 5e+221) || !(z <= 8e+272)) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * y; t_2 = z * (x / -t); tmp = 0.0; if (z <= -3.4e+181) tmp = t_1; elseif (z <= -4.2e+158) tmp = t_2; elseif (z <= -4.8e+28) tmp = z * (y / t); elseif (z <= 4.5e-20) tmp = x; elseif (z <= 4.3e+76) tmp = t_1; elseif (z <= 1.95e+99) tmp = x; elseif ((z <= 5e+221) || ~((z <= 8e+272))) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x / (-t)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.4e+181], t$95$1, If[LessEqual[z, -4.2e+158], t$95$2, If[LessEqual[z, -4.8e+28], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e-20], x, If[LessEqual[z, 4.3e+76], t$95$1, If[LessEqual[z, 1.95e+99], x, If[Or[LessEqual[z, 5e+221], N[Not[LessEqual[z, 8e+272]], $MachinePrecision]], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
t_2 := z \cdot \frac{x}{-t}\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+181}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{+158}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -4.8 \cdot 10^{+28}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.95 \cdot 10^{+99}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 5 \cdot 10^{+221} \lor \neg \left(z \leq 8 \cdot 10^{+272}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.40000000000000031e181 or 4.5000000000000001e-20 < z < 4.29999999999999978e76 or 1.94999999999999997e99 < z < 5.0000000000000002e221 or 8.0000000000000005e272 < z Initial program 88.0%
Taylor expanded in t around 0 79.1%
Taylor expanded in y around inf 58.2%
associate-*r/68.8%
Simplified68.8%
if -3.40000000000000031e181 < z < -4.1999999999999998e158 or 5.0000000000000002e221 < z < 8.0000000000000005e272Initial program 90.1%
Taylor expanded in t around 0 90.1%
Taylor expanded in y around 0 79.6%
mul-1-neg79.6%
distribute-rgt-neg-out79.6%
Simplified79.6%
frac-2neg79.6%
div-inv79.4%
distribute-rgt-neg-out79.4%
remove-double-neg79.4%
Applied egg-rr79.4%
associate-*l*88.6%
associate-*r/88.6%
*-rgt-identity88.6%
Simplified88.6%
if -4.1999999999999998e158 < z < -4.79999999999999962e28Initial program 86.1%
Taylor expanded in t around 0 86.1%
Taylor expanded in y around inf 72.0%
associate-*l/85.8%
*-commutative85.8%
Simplified85.8%
if -4.79999999999999962e28 < z < 4.5000000000000001e-20 or 4.29999999999999978e76 < z < 1.94999999999999997e99Initial program 98.4%
Taylor expanded in z around 0 64.4%
Final simplification68.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ z t) y)))
(if (<= y -4.1e+180)
(/ (* z y) t)
(if (<= y -5.8e+149)
x
(if (<= y -1.2e+17)
t_1
(if (<= y -2.4e-193)
x
(if (<= y 92000000.0) (* (/ z t) (- x)) t_1)))))))
double code(double x, double y, double z, double t) {
double t_1 = (z / t) * y;
double tmp;
if (y <= -4.1e+180) {
tmp = (z * y) / t;
} else if (y <= -5.8e+149) {
tmp = x;
} else if (y <= -1.2e+17) {
tmp = t_1;
} else if (y <= -2.4e-193) {
tmp = x;
} else if (y <= 92000000.0) {
tmp = (z / t) * -x;
} 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 = (z / t) * y
if (y <= (-4.1d+180)) then
tmp = (z * y) / t
else if (y <= (-5.8d+149)) then
tmp = x
else if (y <= (-1.2d+17)) then
tmp = t_1
else if (y <= (-2.4d-193)) then
tmp = x
else if (y <= 92000000.0d0) then
tmp = (z / t) * -x
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 = (z / t) * y;
double tmp;
if (y <= -4.1e+180) {
tmp = (z * y) / t;
} else if (y <= -5.8e+149) {
tmp = x;
} else if (y <= -1.2e+17) {
tmp = t_1;
} else if (y <= -2.4e-193) {
tmp = x;
} else if (y <= 92000000.0) {
tmp = (z / t) * -x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (z / t) * y tmp = 0 if y <= -4.1e+180: tmp = (z * y) / t elif y <= -5.8e+149: tmp = x elif y <= -1.2e+17: tmp = t_1 elif y <= -2.4e-193: tmp = x elif y <= 92000000.0: tmp = (z / t) * -x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z / t) * y) tmp = 0.0 if (y <= -4.1e+180) tmp = Float64(Float64(z * y) / t); elseif (y <= -5.8e+149) tmp = x; elseif (y <= -1.2e+17) tmp = t_1; elseif (y <= -2.4e-193) tmp = x; elseif (y <= 92000000.0) tmp = Float64(Float64(z / t) * Float64(-x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z / t) * y; tmp = 0.0; if (y <= -4.1e+180) tmp = (z * y) / t; elseif (y <= -5.8e+149) tmp = x; elseif (y <= -1.2e+17) tmp = t_1; elseif (y <= -2.4e-193) tmp = x; elseif (y <= 92000000.0) tmp = (z / t) * -x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]}, If[LessEqual[y, -4.1e+180], N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[y, -5.8e+149], x, If[LessEqual[y, -1.2e+17], t$95$1, If[LessEqual[y, -2.4e-193], x, If[LessEqual[y, 92000000.0], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{t} \cdot y\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+180}:\\
\;\;\;\;\frac{z \cdot y}{t}\\
\mathbf{elif}\;y \leq -5.8 \cdot 10^{+149}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq -1.2 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2.4 \cdot 10^{-193}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 92000000:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -4.1e180Initial program 93.1%
Taylor expanded in t around 0 71.4%
Taylor expanded in y around inf 68.1%
*-commutative68.1%
Simplified68.1%
if -4.1e180 < y < -5.8000000000000004e149 or -1.2e17 < y < -2.4e-193Initial program 99.9%
Taylor expanded in z around 0 65.8%
if -5.8000000000000004e149 < y < -1.2e17 or 9.2e7 < y Initial program 90.0%
Taylor expanded in t around 0 64.5%
Taylor expanded in y around inf 61.8%
associate-*r/67.6%
Simplified67.6%
if -2.4e-193 < y < 9.2e7Initial program 93.5%
Taylor expanded in t around 0 58.8%
Taylor expanded in y around 0 55.1%
associate-*r/55.1%
mul-1-neg55.1%
distribute-rgt-neg-out55.1%
associate-*l/59.1%
Simplified59.1%
Final simplification64.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -1.8e+44)
(not (or (<= x -1.6e-5) (and (not (<= x -1.9e-95)) (<= x 4.7e-91)))))
(* x (- 1.0 (/ z t)))
(* (/ z t) y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.8e+44) || !((x <= -1.6e-5) || (!(x <= -1.9e-95) && (x <= 4.7e-91)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (z / t) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.8d+44)) .or. (.not. (x <= (-1.6d-5)) .or. (.not. (x <= (-1.9d-95))) .and. (x <= 4.7d-91))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = (z / t) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.8e+44) || !((x <= -1.6e-5) || (!(x <= -1.9e-95) && (x <= 4.7e-91)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.8e+44) or not ((x <= -1.6e-5) or (not (x <= -1.9e-95) and (x <= 4.7e-91))): tmp = x * (1.0 - (z / t)) else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.8e+44) || !((x <= -1.6e-5) || (!(x <= -1.9e-95) && (x <= 4.7e-91)))) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.8e+44) || ~(((x <= -1.6e-5) || (~((x <= -1.9e-95)) && (x <= 4.7e-91))))) tmp = x * (1.0 - (z / t)); else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.8e+44], N[Not[Or[LessEqual[x, -1.6e-5], And[N[Not[LessEqual[x, -1.9e-95]], $MachinePrecision], LessEqual[x, 4.7e-91]]]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+44} \lor \neg \left(x \leq -1.6 \cdot 10^{-5} \lor \neg \left(x \leq -1.9 \cdot 10^{-95}\right) \land x \leq 4.7 \cdot 10^{-91}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if x < -1.8e44 or -1.59999999999999993e-5 < x < -1.8999999999999999e-95 or 4.70000000000000006e-91 < x Initial program 94.0%
Taylor expanded in x around inf 86.7%
*-commutative86.7%
distribute-lft-in86.7%
*-rgt-identity86.7%
mul-1-neg86.7%
distribute-rgt-neg-in86.7%
unsub-neg86.7%
Simplified86.7%
Taylor expanded in x around 0 86.7%
if -1.8e44 < x < -1.59999999999999993e-5 or -1.8999999999999999e-95 < x < 4.70000000000000006e-91Initial program 92.8%
Taylor expanded in t around 0 71.8%
Taylor expanded in y around inf 66.3%
associate-*r/72.5%
Simplified72.5%
Final simplification81.5%
(FPCore (x y z t)
:precision binary64
(if (or (<= x -3.4e+44)
(not (or (<= x -2.6e-63) (and (not (<= x -2.8e-81)) (<= x 5.8e-75)))))
(* x (- 1.0 (/ z t)))
(* (/ z t) (- y x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.4e+44) || !((x <= -2.6e-63) || (!(x <= -2.8e-81) && (x <= 5.8e-75)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (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 <= (-3.4d+44)) .or. (.not. (x <= (-2.6d-63)) .or. (.not. (x <= (-2.8d-81))) .and. (x <= 5.8d-75))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = (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 <= -3.4e+44) || !((x <= -2.6e-63) || (!(x <= -2.8e-81) && (x <= 5.8e-75)))) {
tmp = x * (1.0 - (z / t));
} else {
tmp = (z / t) * (y - x);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.4e+44) or not ((x <= -2.6e-63) or (not (x <= -2.8e-81) and (x <= 5.8e-75))): tmp = x * (1.0 - (z / t)) else: tmp = (z / t) * (y - x) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.4e+44) || !((x <= -2.6e-63) || (!(x <= -2.8e-81) && (x <= 5.8e-75)))) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(Float64(z / t) * Float64(y - x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.4e+44) || ~(((x <= -2.6e-63) || (~((x <= -2.8e-81)) && (x <= 5.8e-75))))) tmp = x * (1.0 - (z / t)); else tmp = (z / t) * (y - x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.4e+44], N[Not[Or[LessEqual[x, -2.6e-63], And[N[Not[LessEqual[x, -2.8e-81]], $MachinePrecision], LessEqual[x, 5.8e-75]]]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z / t), $MachinePrecision] * N[(y - x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+44} \lor \neg \left(x \leq -2.6 \cdot 10^{-63} \lor \neg \left(x \leq -2.8 \cdot 10^{-81}\right) \land x \leq 5.8 \cdot 10^{-75}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot \left(y - x\right)\\
\end{array}
\end{array}
if x < -3.4e44 or -2.6000000000000001e-63 < x < -2.7999999999999999e-81 or 5.8000000000000003e-75 < x Initial program 93.1%
Taylor expanded in x around inf 89.6%
*-commutative89.6%
distribute-lft-in89.5%
*-rgt-identity89.5%
mul-1-neg89.5%
distribute-rgt-neg-in89.5%
unsub-neg89.5%
Simplified89.5%
Taylor expanded in x around 0 89.6%
if -3.4e44 < x < -2.6000000000000001e-63 or -2.7999999999999999e-81 < x < 5.8000000000000003e-75Initial program 94.1%
Taylor expanded in t around 0 72.2%
*-commutative72.2%
associate-*l/75.5%
Applied egg-rr75.5%
Final simplification83.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.5e+29)
(and (not (<= z 4.6e-20)) (or (<= z 4.3e+76) (not (<= z 1.95e+99)))))
(* (/ z t) y)
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.5e+29) || (!(z <= 4.6e-20) && ((z <= 4.3e+76) || !(z <= 1.95e+99)))) {
tmp = (z / t) * y;
} 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.5d+29)) .or. (.not. (z <= 4.6d-20)) .and. (z <= 4.3d+76) .or. (.not. (z <= 1.95d+99))) then
tmp = (z / t) * y
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.5e+29) || (!(z <= 4.6e-20) && ((z <= 4.3e+76) || !(z <= 1.95e+99)))) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.5e+29) or (not (z <= 4.6e-20) and ((z <= 4.3e+76) or not (z <= 1.95e+99))): tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.5e+29) || (!(z <= 4.6e-20) && ((z <= 4.3e+76) || !(z <= 1.95e+99)))) tmp = Float64(Float64(z / t) * y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.5e+29) || (~((z <= 4.6e-20)) && ((z <= 4.3e+76) || ~((z <= 1.95e+99))))) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.5e+29], And[N[Not[LessEqual[z, 4.6e-20]], $MachinePrecision], Or[LessEqual[z, 4.3e+76], N[Not[LessEqual[z, 1.95e+99]], $MachinePrecision]]]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.5 \cdot 10^{+29} \lor \neg \left(z \leq 4.6 \cdot 10^{-20}\right) \land \left(z \leq 4.3 \cdot 10^{+76} \lor \neg \left(z \leq 1.95 \cdot 10^{+99}\right)\right):\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.5e29 or 4.5999999999999998e-20 < z < 4.29999999999999978e76 or 1.94999999999999997e99 < z Initial program 88.1%
Taylor expanded in t around 0 81.6%
Taylor expanded in y around inf 56.7%
associate-*r/66.0%
Simplified66.0%
if -1.5e29 < z < 4.5999999999999998e-20 or 4.29999999999999978e76 < z < 1.94999999999999997e99Initial program 98.4%
Taylor expanded in z around 0 64.4%
Final simplification65.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.5e-101) (not (<= z 6e-95))) (+ x (* z (/ (- y x) t))) (+ x (* (/ 1.0 t) (* z y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-101) || !(z <= 6e-95)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((1.0 / t) * (z * y));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-6.5d-101)) .or. (.not. (z <= 6d-95))) then
tmp = x + (z * ((y - x) / t))
else
tmp = x + ((1.0d0 / t) * (z * y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.5e-101) || !(z <= 6e-95)) {
tmp = x + (z * ((y - x) / t));
} else {
tmp = x + ((1.0 / t) * (z * y));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.5e-101) or not (z <= 6e-95): tmp = x + (z * ((y - x) / t)) else: tmp = x + ((1.0 / t) * (z * y)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.5e-101) || !(z <= 6e-95)) tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); else tmp = Float64(x + Float64(Float64(1.0 / t) * Float64(z * y))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.5e-101) || ~((z <= 6e-95))) tmp = x + (z * ((y - x) / t)); else tmp = x + ((1.0 / t) * (z * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.5e-101], N[Not[LessEqual[z, 6e-95]], $MachinePrecision]], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / t), $MachinePrecision] * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-101} \lor \neg \left(z \leq 6 \cdot 10^{-95}\right):\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{t} \cdot \left(z \cdot y\right)\\
\end{array}
\end{array}
if z < -6.4999999999999996e-101 or 6e-95 < z Initial program 90.3%
associate-*l/98.7%
Applied egg-rr98.7%
if -6.4999999999999996e-101 < z < 6e-95Initial program 98.8%
clear-num98.8%
associate-/r/98.9%
Applied egg-rr98.9%
Taylor expanded in y around inf 92.0%
*-commutative23.5%
Simplified92.0%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -9.5e-49) (not (<= y 84000.0))) (+ x (* (/ z t) y)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -9.5e-49) || !(y <= 84000.0)) {
tmp = x + ((z / t) * y);
} 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 <= (-9.5d-49)) .or. (.not. (y <= 84000.0d0))) then
tmp = x + ((z / t) * y)
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 <= -9.5e-49) || !(y <= 84000.0)) {
tmp = x + ((z / t) * y);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -9.5e-49) or not (y <= 84000.0): tmp = x + ((z / t) * y) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -9.5e-49) || !(y <= 84000.0)) tmp = Float64(x + Float64(Float64(z / t) * y)); 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 <= -9.5e-49) || ~((y <= 84000.0))) tmp = x + ((z / t) * y); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -9.5e-49], N[Not[LessEqual[y, 84000.0]], $MachinePrecision]], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-49} \lor \neg \left(y \leq 84000\right):\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -9.50000000000000006e-49 or 84000 < y Initial program 92.3%
Taylor expanded in y around inf 89.9%
associate-*r/59.8%
Simplified93.2%
if -9.50000000000000006e-49 < y < 84000Initial program 95.4%
Taylor expanded in x around inf 93.7%
*-commutative93.7%
distribute-lft-in93.7%
*-rgt-identity93.7%
mul-1-neg93.7%
distribute-rgt-neg-in93.7%
unsub-neg93.7%
Simplified93.7%
Taylor expanded in x around 0 93.7%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (<= y -1.95e-48) (+ x (/ y (/ t z))) (if (<= y 11000.0) (* x (- 1.0 (/ z t))) (+ x (* (/ z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-48) {
tmp = x + (y / (t / z));
} else if (y <= 11000.0) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + ((z / t) * y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.95d-48)) then
tmp = x + (y / (t / z))
else if (y <= 11000.0d0) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + ((z / t) * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.95e-48) {
tmp = x + (y / (t / z));
} else if (y <= 11000.0) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + ((z / t) * y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.95e-48: tmp = x + (y / (t / z)) elif y <= 11000.0: tmp = x * (1.0 - (z / t)) else: tmp = x + ((z / t) * y) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.95e-48) tmp = Float64(x + Float64(y / Float64(t / z))); elseif (y <= 11000.0) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(Float64(z / t) * y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.95e-48) tmp = x + (y / (t / z)); elseif (y <= 11000.0) tmp = x * (1.0 - (z / t)); else tmp = x + ((z / t) * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.95e-48], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 11000.0], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-48}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;y \leq 11000:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\end{array}
\end{array}
if y < -1.95e-48Initial program 89.9%
Taylor expanded in y around inf 86.8%
associate-*l/56.7%
*-commutative56.7%
Simplified89.3%
associate-*r/86.8%
*-commutative86.8%
associate-/l*90.5%
Applied egg-rr90.5%
if -1.95e-48 < y < 11000Initial program 95.4%
Taylor expanded in x around inf 93.7%
*-commutative93.7%
distribute-lft-in93.7%
*-rgt-identity93.7%
mul-1-neg93.7%
distribute-rgt-neg-in93.7%
unsub-neg93.7%
Simplified93.7%
Taylor expanded in x around 0 93.7%
if 11000 < y Initial program 95.4%
Taylor expanded in y around inf 93.8%
associate-*r/61.5%
Simplified96.8%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (+ x (/ z (/ t (- y x)))))
double code(double x, double y, double z, double t) {
return x + (z / (t / (y - 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 + (z / (t / (y - x)))
end function
public static double code(double x, double y, double z, double t) {
return x + (z / (t / (y - x)));
}
def code(x, y, z, t): return x + (z / (t / (y - x)))
function code(x, y, z, t) return Float64(x + Float64(z / Float64(t / Float64(y - x)))) end
function tmp = code(x, y, z, t) tmp = x + (z / (t / (y - x))); end
code[x_, y_, z_, t_] := N[(x + N[(z / N[(t / N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z}{\frac{t}{y - x}}
\end{array}
Initial program 93.5%
associate-*l/92.6%
Applied egg-rr92.6%
*-commutative92.6%
clear-num92.1%
un-div-inv93.3%
Applied egg-rr93.3%
Final simplification93.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 93.5%
associate-/l*98.6%
Simplified98.6%
Final simplification98.6%
(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.5%
Taylor expanded in z around 0 39.2%
Final simplification39.2%
(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 2023240
(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)))