
(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 5e+302)))
(+ 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 <= 5e+302)) {
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 <= 5e+302)) {
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 <= 5e+302): 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 <= 5e+302)) 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 <= 5e+302))) 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, 5e+302]], $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 5 \cdot 10^{+302}\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 5e302 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 76.0%
associate-*l/99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 5e302Initial program 99.5%
Final simplification99.6%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -9000000000.0)
(and (not (<= z -3.4e-39))
(or (<= z -3.3e-113) (not (<= z 5.5e-35)))))
(* y (/ z t))
x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9000000000.0) || (!(z <= -3.4e-39) && ((z <= -3.3e-113) || !(z <= 5.5e-35)))) {
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 <= (-9000000000.0d0)) .or. (.not. (z <= (-3.4d-39))) .and. (z <= (-3.3d-113)) .or. (.not. (z <= 5.5d-35))) 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 <= -9000000000.0) || (!(z <= -3.4e-39) && ((z <= -3.3e-113) || !(z <= 5.5e-35)))) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9000000000.0) or (not (z <= -3.4e-39) and ((z <= -3.3e-113) or not (z <= 5.5e-35))): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9000000000.0) || (!(z <= -3.4e-39) && ((z <= -3.3e-113) || !(z <= 5.5e-35)))) 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 <= -9000000000.0) || (~((z <= -3.4e-39)) && ((z <= -3.3e-113) || ~((z <= 5.5e-35))))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9000000000.0], And[N[Not[LessEqual[z, -3.4e-39]], $MachinePrecision], Or[LessEqual[z, -3.3e-113], N[Not[LessEqual[z, 5.5e-35]], $MachinePrecision]]]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9000000000 \lor \neg \left(z \leq -3.4 \cdot 10^{-39}\right) \land \left(z \leq -3.3 \cdot 10^{-113} \lor \neg \left(z \leq 5.5 \cdot 10^{-35}\right)\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9e9 or -3.3999999999999999e-39 < z < -3.3000000000000002e-113 or 5.4999999999999997e-35 < z Initial program 87.8%
Taylor expanded in t around 0 76.3%
Taylor expanded in y around inf 51.8%
associate-*r/57.3%
Simplified57.3%
if -9e9 < z < -3.3999999999999999e-39 or -3.3000000000000002e-113 < z < 5.4999999999999997e-35Initial program 99.4%
Taylor expanded in z around 0 74.7%
Final simplification65.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* y (/ z t))))
(if (<= z -41000000000.0)
t_1
(if (<= z -9e-40)
x
(if (<= z -3.3e-113) t_1 (if (<= z 1.1e-32) x (* z (/ y t))))))))
double code(double x, double y, double z, double t) {
double t_1 = y * (z / t);
double tmp;
if (z <= -41000000000.0) {
tmp = t_1;
} else if (z <= -9e-40) {
tmp = x;
} else if (z <= -3.3e-113) {
tmp = t_1;
} else if (z <= 1.1e-32) {
tmp = x;
} 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 = y * (z / t)
if (z <= (-41000000000.0d0)) then
tmp = t_1
else if (z <= (-9d-40)) then
tmp = x
else if (z <= (-3.3d-113)) then
tmp = t_1
else if (z <= 1.1d-32) then
tmp = x
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 = y * (z / t);
double tmp;
if (z <= -41000000000.0) {
tmp = t_1;
} else if (z <= -9e-40) {
tmp = x;
} else if (z <= -3.3e-113) {
tmp = t_1;
} else if (z <= 1.1e-32) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = y * (z / t) tmp = 0 if z <= -41000000000.0: tmp = t_1 elif z <= -9e-40: tmp = x elif z <= -3.3e-113: tmp = t_1 elif z <= 1.1e-32: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) t_1 = Float64(y * Float64(z / t)) tmp = 0.0 if (z <= -41000000000.0) tmp = t_1; elseif (z <= -9e-40) tmp = x; elseif (z <= -3.3e-113) tmp = t_1; elseif (z <= 1.1e-32) tmp = x; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = y * (z / t); tmp = 0.0; if (z <= -41000000000.0) tmp = t_1; elseif (z <= -9e-40) tmp = x; elseif (z <= -3.3e-113) tmp = t_1; elseif (z <= 1.1e-32) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -41000000000.0], t$95$1, If[LessEqual[z, -9e-40], x, If[LessEqual[z, -3.3e-113], t$95$1, If[LessEqual[z, 1.1e-32], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t}\\
\mathbf{if}\;z \leq -41000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-40}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-113}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -4.1e10 or -9.0000000000000002e-40 < z < -3.3000000000000002e-113Initial program 89.5%
Taylor expanded in t around 0 76.0%
Taylor expanded in y around inf 47.8%
associate-*r/51.4%
Simplified51.4%
if -4.1e10 < z < -9.0000000000000002e-40 or -3.3000000000000002e-113 < z < 1.1e-32Initial program 99.4%
Taylor expanded in z around 0 74.7%
if 1.1e-32 < z Initial program 85.4%
Taylor expanded in t around 0 76.8%
Taylor expanded in y around inf 57.6%
associate-*l/65.7%
*-commutative65.7%
Simplified65.7%
Final simplification65.2%
(FPCore (x y z t)
:precision binary64
(if (<= z -30500000000000.0)
(* y (/ z t))
(if (<= z -1.9e-35)
x
(if (<= z -3.2e-113) (/ y (/ t z)) (if (<= z 4.8e-32) x (* z (/ y t)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -30500000000000.0) {
tmp = y * (z / t);
} else if (z <= -1.9e-35) {
tmp = x;
} else if (z <= -3.2e-113) {
tmp = y / (t / z);
} else if (z <= 4.8e-32) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-30500000000000.0d0)) then
tmp = y * (z / t)
else if (z <= (-1.9d-35)) then
tmp = x
else if (z <= (-3.2d-113)) then
tmp = y / (t / z)
else if (z <= 4.8d-32) then
tmp = x
else
tmp = z * (y / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -30500000000000.0) {
tmp = y * (z / t);
} else if (z <= -1.9e-35) {
tmp = x;
} else if (z <= -3.2e-113) {
tmp = y / (t / z);
} else if (z <= 4.8e-32) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -30500000000000.0: tmp = y * (z / t) elif z <= -1.9e-35: tmp = x elif z <= -3.2e-113: tmp = y / (t / z) elif z <= 4.8e-32: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -30500000000000.0) tmp = Float64(y * Float64(z / t)); elseif (z <= -1.9e-35) tmp = x; elseif (z <= -3.2e-113) tmp = Float64(y / Float64(t / z)); elseif (z <= 4.8e-32) tmp = x; else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -30500000000000.0) tmp = y * (z / t); elseif (z <= -1.9e-35) tmp = x; elseif (z <= -3.2e-113) tmp = y / (t / z); elseif (z <= 4.8e-32) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -30500000000000.0], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.9e-35], x, If[LessEqual[z, -3.2e-113], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-32], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -30500000000000:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-35}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-113}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-32}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if z < -3.05e13Initial program 87.3%
Taylor expanded in t around 0 75.8%
Taylor expanded in y around inf 46.5%
associate-*r/50.9%
Simplified50.9%
if -3.05e13 < z < -1.9000000000000001e-35 or -3.2000000000000002e-113 < z < 4.8000000000000003e-32Initial program 99.4%
Taylor expanded in z around 0 74.7%
if -1.9000000000000001e-35 < z < -3.2000000000000002e-113Initial program 99.6%
Taylor expanded in t around 0 76.7%
Taylor expanded in y around inf 53.8%
associate-*r/53.9%
Simplified53.9%
clear-num54.1%
un-div-inv54.2%
Applied egg-rr54.2%
if 4.8000000000000003e-32 < z Initial program 85.4%
Taylor expanded in t around 0 76.8%
Taylor expanded in y around inf 57.6%
associate-*l/65.7%
*-commutative65.7%
Simplified65.7%
Final simplification65.2%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4e-40) (not (<= x 5e-231))) (* x (- 1.0 (/ z t))) (* y (/ z t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4e-40) || !(x <= 5e-231)) {
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 <= (-4d-40)) .or. (.not. (x <= 5d-231))) 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 <= -4e-40) || !(x <= 5e-231)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4e-40) or not (x <= 5e-231): tmp = x * (1.0 - (z / t)) else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4e-40) || !(x <= 5e-231)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4e-40) || ~((x <= 5e-231))) 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, -4e-40], N[Not[LessEqual[x, 5e-231]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-40} \lor \neg \left(x \leq 5 \cdot 10^{-231}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -3.9999999999999997e-40 or 5.00000000000000023e-231 < x Initial program 92.9%
associate-*l/91.1%
Applied egg-rr91.1%
Taylor expanded in x around inf 81.9%
*-commutative81.9%
mul-1-neg81.9%
sub-neg81.9%
Simplified81.9%
if -3.9999999999999997e-40 < x < 5.00000000000000023e-231Initial program 93.4%
Taylor expanded in t around 0 73.2%
Taylor expanded in y around inf 71.0%
associate-*r/73.4%
Simplified73.4%
Final simplification79.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.9e+14) (not (<= z 1.15e-46))) (* z (/ (- y x) t)) (* x (- 1.0 (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e+14) || !(z <= 1.15e-46)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-2.9d+14)) .or. (.not. (z <= 1.15d-46))) then
tmp = z * ((y - x) / t)
else
tmp = x * (1.0d0 - (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.9e+14) || !(z <= 1.15e-46)) {
tmp = z * ((y - x) / t);
} else {
tmp = x * (1.0 - (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.9e+14) or not (z <= 1.15e-46): tmp = z * ((y - x) / t) else: tmp = x * (1.0 - (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.9e+14) || !(z <= 1.15e-46)) tmp = Float64(z * Float64(Float64(y - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.9e+14) || ~((z <= 1.15e-46))) tmp = z * ((y - x) / t); else tmp = x * (1.0 - (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.9e+14], N[Not[LessEqual[z, 1.15e-46]], $MachinePrecision]], N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.9 \cdot 10^{+14} \lor \neg \left(z \leq 1.15 \cdot 10^{-46}\right):\\
\;\;\;\;z \cdot \frac{y - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\end{array}
\end{array}
if z < -2.9e14 or 1.15e-46 < z Initial program 87.0%
Taylor expanded in t around 0 76.8%
associate-*l/98.1%
Applied egg-rr84.4%
if -2.9e14 < z < 1.15e-46Initial program 98.8%
associate-*l/85.7%
Applied egg-rr85.7%
Taylor expanded in x around inf 80.5%
*-commutative80.5%
mul-1-neg80.5%
sub-neg80.5%
Simplified80.5%
Final simplification82.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.35e+30) (not (<= x 1.8e-28))) (* x (- 1.0 (/ z t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.35e+30) || !(x <= 1.8e-28)) {
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.35d+30)) .or. (.not. (x <= 1.8d-28))) 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.35e+30) || !(x <= 1.8e-28)) {
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.35e+30) or not (x <= 1.8e-28): 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.35e+30) || !(x <= 1.8e-28)) 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.35e+30) || ~((x <= 1.8e-28))) 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.35e+30], N[Not[LessEqual[x, 1.8e-28]], $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.35 \cdot 10^{+30} \lor \neg \left(x \leq 1.8 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -2.34999999999999995e30 or 1.7999999999999999e-28 < x Initial program 91.0%
associate-*l/90.1%
Applied egg-rr90.1%
Taylor expanded in x around inf 91.3%
*-commutative91.3%
mul-1-neg91.3%
sub-neg91.3%
Simplified91.3%
if -2.34999999999999995e30 < x < 1.7999999999999999e-28Initial program 94.8%
Taylor expanded in y around inf 86.8%
associate-*r/57.8%
Simplified88.9%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= x -1.7e+27) (not (<= x 3e-28))) (* x (- 1.0 (/ z t))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e+27) || !(x <= 3e-28)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-1.7d+27)) .or. (.not. (x <= 3d-28))) then
tmp = x * (1.0d0 - (z / t))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -1.7e+27) || !(x <= 3e-28)) {
tmp = x * (1.0 - (z / t));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -1.7e+27) or not (x <= 3e-28): tmp = x * (1.0 - (z / t)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -1.7e+27) || !(x <= 3e-28)) tmp = Float64(x * Float64(1.0 - Float64(z / t))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -1.7e+27) || ~((x <= 3e-28))) tmp = x * (1.0 - (z / t)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -1.7e+27], N[Not[LessEqual[x, 3e-28]], $MachinePrecision]], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+27} \lor \neg \left(x \leq 3 \cdot 10^{-28}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -1.7e27 or 3.00000000000000003e-28 < x Initial program 91.0%
associate-*l/90.1%
Applied egg-rr90.1%
Taylor expanded in x around inf 91.3%
*-commutative91.3%
mul-1-neg91.3%
sub-neg91.3%
Simplified91.3%
if -1.7e27 < x < 3.00000000000000003e-28Initial program 94.8%
Taylor expanded in y around inf 86.8%
associate-*r/57.8%
Simplified88.9%
clear-num57.7%
un-div-inv58.0%
Applied egg-rr89.1%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= x -5e+28) (* x (- 1.0 (/ z t))) (if (<= x 1.75e-28) (+ x (/ y (/ t z))) (- x (* x (/ z t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+28) {
tmp = x * (1.0 - (z / t));
} else if (x <= 1.75e-28) {
tmp = x + (y / (t / z));
} else {
tmp = x - (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 (x <= (-5d+28)) then
tmp = x * (1.0d0 - (z / t))
else if (x <= 1.75d-28) then
tmp = x + (y / (t / z))
else
tmp = x - (x * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -5e+28) {
tmp = x * (1.0 - (z / t));
} else if (x <= 1.75e-28) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -5e+28: tmp = x * (1.0 - (z / t)) elif x <= 1.75e-28: tmp = x + (y / (t / z)) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -5e+28) tmp = Float64(x * Float64(1.0 - Float64(z / t))); elseif (x <= 1.75e-28) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(x * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -5e+28) tmp = x * (1.0 - (z / t)); elseif (x <= 1.75e-28) tmp = x + (y / (t / z)); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -5e+28], N[(x * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e-28], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+28}:\\
\;\;\;\;x \cdot \left(1 - \frac{z}{t}\right)\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-28}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.99999999999999957e28Initial program 88.0%
associate-*l/90.9%
Applied egg-rr90.9%
Taylor expanded in x around inf 90.6%
*-commutative90.6%
mul-1-neg90.6%
sub-neg90.6%
Simplified90.6%
if -4.99999999999999957e28 < x < 1.75e-28Initial program 94.8%
Taylor expanded in y around inf 86.8%
associate-*r/57.8%
Simplified88.9%
clear-num57.7%
un-div-inv58.0%
Applied egg-rr89.1%
if 1.75e-28 < x Initial program 94.7%
Taylor expanded in y around 0 87.3%
associate-*r/87.3%
mul-1-neg87.3%
distribute-rgt-neg-out87.3%
associate-*l/92.3%
Simplified92.3%
*-commutative92.3%
add-sqr-sqrt92.2%
sqrt-unprod66.7%
sqr-neg66.7%
sqrt-unprod0.0%
add-sqr-sqrt45.6%
cancel-sign-sub-inv45.6%
add-sqr-sqrt0.0%
sqrt-unprod66.7%
sqr-neg66.7%
sqrt-unprod92.2%
add-sqr-sqrt92.3%
Applied egg-rr92.3%
Final simplification90.1%
(FPCore (x y z t) :precision binary64 (if (<= y -1.15e+55) (+ x (* y (/ z t))) (+ x (* z (/ (- y x) t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e+55) {
tmp = x + (y * (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-1.15d+55)) then
tmp = x + (y * (z / t))
else
tmp = x + (z * ((y - x) / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.15e+55) {
tmp = x + (y * (z / t));
} else {
tmp = x + (z * ((y - x) / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.15e+55: tmp = x + (y * (z / t)) else: tmp = x + (z * ((y - x) / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.15e+55) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(x + Float64(z * Float64(Float64(y - x) / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.15e+55) tmp = x + (y * (z / t)); else tmp = x + (z * ((y - x) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.15e+55], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.15 \cdot 10^{+55}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y - x}{t}\\
\end{array}
\end{array}
if y < -1.14999999999999994e55Initial program 93.2%
Taylor expanded in y around inf 88.6%
associate-*r/63.8%
Simplified95.2%
if -1.14999999999999994e55 < y Initial program 93.0%
associate-*l/94.2%
Applied egg-rr94.2%
Final simplification94.4%
(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.1%
associate-/l*98.2%
Simplified98.2%
Final simplification98.2%
(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.1%
Taylor expanded in z around 0 42.1%
Final simplification42.1%
(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 2023257
(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)))