
(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
(let* ((t_1 (+ x (/ (* z (- y x)) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+292)))
(+ 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 <= 5e+292)) {
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 <= 5e+292)) {
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 <= 5e+292): 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 <= 5e+292)) 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 <= 5e+292))) 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, 5e+292]], $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 5 \cdot 10^{+292}\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 4.9999999999999996e292 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 67.7%
associate-*l/99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 4.9999999999999996e292Initial 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 89.1%
+-commutative89.1%
*-commutative89.1%
associate-*l/98.9%
fma-def98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ z t)))))
(if (<= x -2.55e-48)
t_1
(if (<= x 3.2e-162)
(* (/ z t) y)
(if (or (<= x 5.1e+31) (not (<= x 7.8e+43))) t_1 (* z (/ y t)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.55e-48) {
tmp = t_1;
} else if (x <= 3.2e-162) {
tmp = (z / t) * y;
} else if ((x <= 5.1e+31) || !(x <= 7.8e+43)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (1.0d0 - (z / t))
if (x <= (-2.55d-48)) then
tmp = t_1
else if (x <= 3.2d-162) then
tmp = (z / t) * y
else if ((x <= 5.1d+31) .or. (.not. (x <= 7.8d+43))) then
tmp = t_1
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (z / t));
double tmp;
if (x <= -2.55e-48) {
tmp = t_1;
} else if (x <= 3.2e-162) {
tmp = (z / t) * y;
} else if ((x <= 5.1e+31) || !(x <= 7.8e+43)) {
tmp = t_1;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (z / t)) tmp = 0 if x <= -2.55e-48: tmp = t_1 elif x <= 3.2e-162: tmp = (z / t) * y elif (x <= 5.1e+31) or not (x <= 7.8e+43): tmp = t_1 else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(z / t))) tmp = 0.0 if (x <= -2.55e-48) tmp = t_1; elseif (x <= 3.2e-162) tmp = Float64(Float64(z / t) * y); elseif ((x <= 5.1e+31) || !(x <= 7.8e+43)) tmp = t_1; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (z / t)); tmp = 0.0; if (x <= -2.55e-48) tmp = t_1; elseif (x <= 3.2e-162) tmp = (z / t) * y; elseif ((x <= 5.1e+31) || ~((x <= 7.8e+43))) tmp = t_1; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.55e-48], t$95$1, If[LessEqual[x, 3.2e-162], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], If[Or[LessEqual[x, 5.1e+31], N[Not[LessEqual[x, 7.8e+43]], $MachinePrecision]], t$95$1, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{if}\;x \leq -2.55 \cdot 10^{-48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.2 \cdot 10^{-162}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{elif}\;x \leq 5.1 \cdot 10^{+31} \lor \neg \left(x \leq 7.8 \cdot 10^{+43}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.55000000000000006e-48 or 3.19999999999999975e-162 < x < 5.0999999999999997e31 or 7.8000000000000001e43 < x Initial program 87.0%
Taylor expanded in x around inf 81.9%
*-commutative81.9%
distribute-lft-in81.9%
*-rgt-identity81.9%
mul-1-neg81.9%
distribute-rgt-neg-in81.9%
unsub-neg81.9%
Simplified81.9%
Taylor expanded in x around 0 81.9%
if -2.55000000000000006e-48 < x < 3.19999999999999975e-162Initial program 92.4%
Taylor expanded in t around 0 79.2%
Taylor expanded in y around inf 75.5%
associate-*r/80.3%
Simplified80.3%
if 5.0999999999999997e31 < x < 7.8000000000000001e43Initial program 99.7%
Taylor expanded in t around 0 99.7%
Taylor expanded in y around inf 99.7%
associate-*l/100.0%
*-commutative100.0%
Simplified100.0%
Final simplification81.7%
(FPCore (x y z t)
:precision binary64
(if (<= t -2.25e+89)
x
(if (or (<= t -4.6e-95) (and (not (<= t -3.45e-121)) (<= t 1.55e+65)))
(* (/ z t) y)
x)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.25e+89) {
tmp = x;
} else if ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65))) {
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 (t <= (-2.25d+89)) then
tmp = x
else if ((t <= (-4.6d-95)) .or. (.not. (t <= (-3.45d-121))) .and. (t <= 1.55d+65)) 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 (t <= -2.25e+89) {
tmp = x;
} else if ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65))) {
tmp = (z / t) * y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.25e+89: tmp = x elif (t <= -4.6e-95) or (not (t <= -3.45e-121) and (t <= 1.55e+65)): tmp = (z / t) * y else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.25e+89) tmp = x; elseif ((t <= -4.6e-95) || (!(t <= -3.45e-121) && (t <= 1.55e+65))) 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 (t <= -2.25e+89) tmp = x; elseif ((t <= -4.6e-95) || (~((t <= -3.45e-121)) && (t <= 1.55e+65))) tmp = (z / t) * y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.25e+89], x, If[Or[LessEqual[t, -4.6e-95], And[N[Not[LessEqual[t, -3.45e-121]], $MachinePrecision], LessEqual[t, 1.55e+65]]], N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+89}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -4.6 \cdot 10^{-95} \lor \neg \left(t \leq -3.45 \cdot 10^{-121}\right) \land t \leq 1.55 \cdot 10^{+65}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.25e89 or -4.59999999999999998e-95 < t < -3.45e-121 or 1.54999999999999995e65 < t Initial program 76.7%
Taylor expanded in z around 0 68.2%
if -2.25e89 < t < -4.59999999999999998e-95 or -3.45e-121 < t < 1.54999999999999995e65Initial program 97.4%
Taylor expanded in t around 0 81.5%
Taylor expanded in y around inf 58.7%
associate-*r/61.4%
Simplified61.4%
Final simplification64.1%
(FPCore (x y z t) :precision binary64 (if (<= z -7e+200) (* (/ x t) (- z)) (if (<= z -1.9e-69) (* z (/ y t)) (if (<= z 7.8e-137) x (* (/ z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+200) {
tmp = (x / t) * -z;
} else if (z <= -1.9e-69) {
tmp = z * (y / t);
} else if (z <= 7.8e-137) {
tmp = x;
} 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 (z <= (-7d+200)) then
tmp = (x / t) * -z
else if (z <= (-1.9d-69)) then
tmp = z * (y / t)
else if (z <= 7.8d-137) then
tmp = x
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 (z <= -7e+200) {
tmp = (x / t) * -z;
} else if (z <= -1.9e-69) {
tmp = z * (y / t);
} else if (z <= 7.8e-137) {
tmp = x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e+200: tmp = (x / t) * -z elif z <= -1.9e-69: tmp = z * (y / t) elif z <= 7.8e-137: tmp = x else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+200) tmp = Float64(Float64(x / t) * Float64(-z)); elseif (z <= -1.9e-69) tmp = Float64(z * Float64(y / t)); elseif (z <= 7.8e-137) tmp = x; else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e+200) tmp = (x / t) * -z; elseif (z <= -1.9e-69) tmp = z * (y / t); elseif (z <= 7.8e-137) tmp = x; else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+200], N[(N[(x / t), $MachinePrecision] * (-z)), $MachinePrecision], If[LessEqual[z, -1.9e-69], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.8e-137], x, N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+200}:\\
\;\;\;\;\frac{x}{t} \cdot \left(-z\right)\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-69}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if z < -7.00000000000000013e200Initial program 73.2%
Taylor expanded in x around inf 92.0%
*-commutative92.0%
distribute-lft-in92.0%
*-rgt-identity92.0%
mul-1-neg92.0%
distribute-rgt-neg-in92.0%
unsub-neg92.0%
Simplified92.0%
Taylor expanded in x around 0 92.0%
Taylor expanded in z around inf 53.9%
associate-*r/61.2%
neg-mul-161.2%
distribute-rgt-neg-in61.2%
Simplified61.2%
if -7.00000000000000013e200 < z < -1.8999999999999999e-69Initial program 81.8%
Taylor expanded in t around 0 67.1%
Taylor expanded in y around inf 48.0%
associate-*l/55.2%
*-commutative55.2%
Simplified55.2%
if -1.8999999999999999e-69 < z < 7.7999999999999999e-137Initial program 98.9%
Taylor expanded in z around 0 66.2%
if 7.7999999999999999e-137 < z Initial program 87.3%
Taylor expanded in t around 0 73.9%
Taylor expanded in y around inf 55.4%
associate-*r/65.5%
Simplified65.5%
Final simplification63.2%
(FPCore (x y z t) :precision binary64 (if (<= z -9.5e+189) (* (/ z t) (- x)) (if (<= z -1.2e-67) (* z (/ y t)) (if (<= z 6.5e-137) x (* (/ z t) y)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -9.5e+189) {
tmp = (z / t) * -x;
} else if (z <= -1.2e-67) {
tmp = z * (y / t);
} else if (z <= 6.5e-137) {
tmp = x;
} 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 (z <= (-9.5d+189)) then
tmp = (z / t) * -x
else if (z <= (-1.2d-67)) then
tmp = z * (y / t)
else if (z <= 6.5d-137) then
tmp = x
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 (z <= -9.5e+189) {
tmp = (z / t) * -x;
} else if (z <= -1.2e-67) {
tmp = z * (y / t);
} else if (z <= 6.5e-137) {
tmp = x;
} else {
tmp = (z / t) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -9.5e+189: tmp = (z / t) * -x elif z <= -1.2e-67: tmp = z * (y / t) elif z <= 6.5e-137: tmp = x else: tmp = (z / t) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -9.5e+189) tmp = Float64(Float64(z / t) * Float64(-x)); elseif (z <= -1.2e-67) tmp = Float64(z * Float64(y / t)); elseif (z <= 6.5e-137) tmp = x; else tmp = Float64(Float64(z / t) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -9.5e+189) tmp = (z / t) * -x; elseif (z <= -1.2e-67) tmp = z * (y / t); elseif (z <= 6.5e-137) tmp = x; else tmp = (z / t) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -9.5e+189], N[(N[(z / t), $MachinePrecision] * (-x)), $MachinePrecision], If[LessEqual[z, -1.2e-67], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.5e-137], x, N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.5 \cdot 10^{+189}:\\
\;\;\;\;\frac{z}{t} \cdot \left(-x\right)\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-67}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-137}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{t} \cdot y\\
\end{array}
\end{array}
if z < -9.49999999999999911e189Initial program 65.8%
Taylor expanded in t around 0 65.8%
Taylor expanded in y around 0 48.6%
associate-*r/48.6%
mul-1-neg48.6%
distribute-rgt-neg-out48.6%
associate-*l/75.3%
Simplified75.3%
if -9.49999999999999911e189 < z < -1.2e-67Initial program 86.5%
Taylor expanded in t around 0 70.9%
Taylor expanded in y around inf 50.8%
associate-*l/56.4%
*-commutative56.4%
Simplified56.4%
if -1.2e-67 < z < 6.49999999999999991e-137Initial program 98.9%
Taylor expanded in z around 0 66.2%
if 6.49999999999999991e-137 < z Initial program 87.3%
Taylor expanded in t around 0 73.9%
Taylor expanded in y around inf 55.4%
associate-*r/65.5%
Simplified65.5%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.2e-19) (not (<= y 7.4e-152))) (+ x (* (/ z t) y)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e-19) || !(y <= 7.4e-152)) {
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 <= (-6.2d-19)) .or. (.not. (y <= 7.4d-152))) 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 <= -6.2e-19) || !(y <= 7.4e-152)) {
tmp = x + ((z / t) * y);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.2e-19) or not (y <= 7.4e-152): 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 <= -6.2e-19) || !(y <= 7.4e-152)) 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 <= -6.2e-19) || ~((y <= 7.4e-152))) 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, -6.2e-19], N[Not[LessEqual[y, 7.4e-152]], $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 -6.2 \cdot 10^{-19} \lor \neg \left(y \leq 7.4 \cdot 10^{-152}\right):\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if y < -6.1999999999999998e-19 or 7.3999999999999997e-152 < y Initial program 88.5%
Taylor expanded in y around inf 85.5%
associate-*r/60.5%
Simplified92.7%
if -6.1999999999999998e-19 < y < 7.3999999999999997e-152Initial program 90.5%
Taylor expanded in x around inf 91.6%
*-commutative91.6%
distribute-lft-in91.6%
*-rgt-identity91.6%
mul-1-neg91.6%
distribute-rgt-neg-in91.6%
unsub-neg91.6%
Simplified91.6%
Taylor expanded in x around 0 91.6%
Final simplification92.4%
(FPCore (x y z t) :precision binary64 (if (<= y -8.8e+82) (+ x (* (/ z t) y)) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -8.8e+82) {
tmp = x + ((z / t) * y);
} 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 (y <= (-8.8d+82)) then
tmp = x + ((z / t) * y)
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 (y <= -8.8e+82) {
tmp = x + ((z / t) * y);
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -8.8e+82: tmp = x + ((z / t) * y) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -8.8e+82) tmp = Float64(x + Float64(Float64(z / t) * y)); 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 (y <= -8.8e+82) tmp = x + ((z / t) * y); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -8.8e+82], N[(x + N[(N[(z / t), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.8 \cdot 10^{+82}:\\
\;\;\;\;x + \frac{z}{t} \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if y < -8.8000000000000005e82Initial program 79.1%
Taylor expanded in y around inf 80.9%
associate-*r/66.4%
Simplified97.7%
if -8.8000000000000005e82 < y Initial program 93.2%
associate-*l/92.6%
Applied egg-rr92.6%
Final simplification94.1%
(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 89.1%
associate-/l*98.7%
Simplified98.7%
Final simplification98.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 89.1%
Taylor expanded in z around 0 36.9%
Final simplification36.9%
(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 2023238
(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)))