
(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 14 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 2e+306)))
(+ 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 <= 2e+306)) {
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 <= 2e+306)) {
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 <= 2e+306): 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 <= 2e+306)) 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 <= 2e+306))) 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, 2e+306]], $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 2 \cdot 10^{+306}\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 2.00000000000000003e306 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) Initial program 78.4%
associate-*l/99.9%
Simplified99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 (-.f64 y x) z) t)) < 2.00000000000000003e306Initial program 97.1%
Final simplification98.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.7e-40) (not (<= z 5.2e-113))) (* (- y x) (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.7e-40) || !(z <= 5.2e-113)) {
tmp = (y - x) * (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 <= (-1.7d-40)) .or. (.not. (z <= 5.2d-113))) then
tmp = (y - x) * (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 <= -1.7e-40) || !(z <= 5.2e-113)) {
tmp = (y - x) * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.7e-40) or not (z <= 5.2e-113): tmp = (y - x) * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.7e-40) || !(z <= 5.2e-113)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.7e-40) || ~((z <= 5.2e-113))) tmp = (y - x) * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.7e-40], N[Not[LessEqual[z, 5.2e-113]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.7 \cdot 10^{-40} \lor \neg \left(z \leq 5.2 \cdot 10^{-113}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.69999999999999992e-40 or 5.1999999999999998e-113 < z Initial program 87.8%
associate-*l/97.5%
Simplified97.5%
associate-*l/87.8%
associate-/l*97.8%
div-sub85.6%
associate-+r-85.6%
div-inv84.7%
clear-num84.8%
div-inv84.1%
clear-num84.1%
Applied egg-rr84.1%
Taylor expanded in t around 0 70.8%
distribute-rgt-out--74.6%
associate-*l/79.4%
Simplified79.4%
if -1.69999999999999992e-40 < z < 5.1999999999999998e-113Initial program 95.2%
associate-*l/89.5%
Simplified89.5%
Taylor expanded in t around inf 73.9%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e+77) (not (<= z 3e-73))) (* (- y x) (/ z t)) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e+77) || !(z <= 3e-73)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-5.5d+77)) .or. (.not. (z <= 3d-73))) then
tmp = (y - x) * (z / t)
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e+77) || !(z <= 3e-73)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e+77) or not (z <= 3e-73): tmp = (y - x) * (z / t) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e+77) || !(z <= 3e-73)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5.5e+77) || ~((z <= 3e-73))) tmp = (y - x) * (z / t); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e+77], N[Not[LessEqual[z, 3e-73]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+77} \lor \neg \left(z \leq 3 \cdot 10^{-73}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -5.50000000000000036e77 or 3e-73 < z Initial program 85.5%
associate-*l/97.6%
Simplified97.6%
associate-*l/85.5%
associate-/l*97.2%
div-sub82.8%
associate-+r-82.8%
div-inv81.6%
clear-num81.7%
div-inv80.8%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in t around 0 73.7%
distribute-rgt-out--78.5%
associate-*l/84.6%
Simplified84.6%
if -5.50000000000000036e77 < z < 3e-73Initial program 95.6%
associate-*l/91.3%
Simplified91.3%
Taylor expanded in y around inf 87.5%
associate-*r/87.1%
Simplified87.1%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.65e+77) (not (<= z 4.8e-74))) (* (- y x) (/ z t)) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.65e+77) || !(z <= 4.8e-74)) {
tmp = (y - x) * (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 ((z <= (-1.65d+77)) .or. (.not. (z <= 4.8d-74))) then
tmp = (y - x) * (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 ((z <= -1.65e+77) || !(z <= 4.8e-74)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.65e+77) or not (z <= 4.8e-74): tmp = (y - x) * (z / t) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.65e+77) || !(z <= 4.8e-74)) tmp = Float64(Float64(y - x) * 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 ((z <= -1.65e+77) || ~((z <= 4.8e-74))) tmp = (y - x) * (z / t); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.65e+77], N[Not[LessEqual[z, 4.8e-74]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{+77} \lor \neg \left(z \leq 4.8 \cdot 10^{-74}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if z < -1.6499999999999999e77 or 4.7999999999999998e-74 < z Initial program 85.5%
associate-*l/97.6%
Simplified97.6%
associate-*l/85.5%
associate-/l*97.2%
div-sub82.8%
associate-+r-82.8%
div-inv81.6%
clear-num81.7%
div-inv80.8%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in t around 0 73.7%
distribute-rgt-out--78.5%
associate-*l/84.6%
Simplified84.6%
if -1.6499999999999999e77 < z < 4.7999999999999998e-74Initial program 95.6%
associate-*l/91.3%
Simplified91.3%
Taylor expanded in y around inf 87.5%
associate-*r/87.1%
Simplified87.1%
clear-num87.0%
un-div-inv87.1%
Applied egg-rr87.1%
Final simplification85.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.25e+78) (not (<= z 3e-73))) (* (- y x) (/ z t)) (+ x (/ (* y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.25e+78) || !(z <= 3e-73)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-3.25d+78)) .or. (.not. (z <= 3d-73))) then
tmp = (y - x) * (z / t)
else
tmp = x + ((y * z) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.25e+78) || !(z <= 3e-73)) {
tmp = (y - x) * (z / t);
} else {
tmp = x + ((y * z) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.25e+78) or not (z <= 3e-73): tmp = (y - x) * (z / t) else: tmp = x + ((y * z) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.25e+78) || !(z <= 3e-73)) tmp = Float64(Float64(y - x) * Float64(z / t)); else tmp = Float64(x + Float64(Float64(y * z) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -3.25e+78) || ~((z <= 3e-73))) tmp = (y - x) * (z / t); else tmp = x + ((y * z) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.25e+78], N[Not[LessEqual[z, 3e-73]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.25 \cdot 10^{+78} \lor \neg \left(z \leq 3 \cdot 10^{-73}\right):\\
\;\;\;\;\left(y - x\right) \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{t}\\
\end{array}
\end{array}
if z < -3.25000000000000018e78 or 3e-73 < z Initial program 85.5%
associate-*l/97.6%
Simplified97.6%
associate-*l/85.5%
associate-/l*97.2%
div-sub82.8%
associate-+r-82.8%
div-inv81.6%
clear-num81.7%
div-inv80.8%
clear-num80.9%
Applied egg-rr80.9%
Taylor expanded in t around 0 73.7%
distribute-rgt-out--78.5%
associate-*l/84.6%
Simplified84.6%
if -3.25000000000000018e78 < z < 3e-73Initial program 95.6%
associate-*l/91.3%
Simplified91.3%
Taylor expanded in y around inf 87.5%
*-commutative87.5%
Simplified87.5%
Final simplification86.1%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.06e-68) (not (<= y 1.05e+66))) (+ x (/ y (/ t z))) (- x (* z (/ x t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.06e-68) || !(y <= 1.05e+66)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (z * (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.06d-68)) .or. (.not. (y <= 1.05d+66))) then
tmp = x + (y / (t / z))
else
tmp = x - (z * (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.06e-68) || !(y <= 1.05e+66)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (z * (x / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.06e-68) or not (y <= 1.05e+66): tmp = x + (y / (t / z)) else: tmp = x - (z * (x / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.06e-68) || !(y <= 1.05e+66)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(z * Float64(x / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.06e-68) || ~((y <= 1.05e+66))) tmp = x + (y / (t / z)); else tmp = x - (z * (x / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.06e-68], N[Not[LessEqual[y, 1.05e+66]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.06 \cdot 10^{-68} \lor \neg \left(y \leq 1.05 \cdot 10^{+66}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - z \cdot \frac{x}{t}\\
\end{array}
\end{array}
if y < -1.06e-68 or 1.05000000000000003e66 < y Initial program 88.4%
associate-*l/92.3%
Simplified92.3%
Taylor expanded in y around inf 86.1%
associate-*r/92.1%
Simplified92.1%
clear-num92.0%
un-div-inv92.2%
Applied egg-rr92.2%
if -1.06e-68 < y < 1.05000000000000003e66Initial program 92.7%
associate-*l/96.4%
Simplified96.4%
associate-/r/97.4%
clear-num97.4%
Applied egg-rr97.4%
Taylor expanded in y around 0 86.3%
*-commutative86.3%
associate-/l*87.7%
neg-mul-187.7%
sub-neg87.7%
associate-/l*86.3%
associate-*r/87.7%
Simplified87.7%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -3e-73) (not (<= y 1.05e+66))) (+ x (/ y (/ t z))) (- x (/ z (/ t x)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e-73) || !(y <= 1.05e+66)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (z / (t / 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 ((y <= (-3d-73)) .or. (.not. (y <= 1.05d+66))) then
tmp = x + (y / (t / z))
else
tmp = x - (z / (t / x))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -3e-73) || !(y <= 1.05e+66)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (z / (t / x));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -3e-73) or not (y <= 1.05e+66): tmp = x + (y / (t / z)) else: tmp = x - (z / (t / x)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -3e-73) || !(y <= 1.05e+66)) tmp = Float64(x + Float64(y / Float64(t / z))); else tmp = Float64(x - Float64(z / Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -3e-73) || ~((y <= 1.05e+66))) tmp = x + (y / (t / z)); else tmp = x - (z / (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -3e-73], N[Not[LessEqual[y, 1.05e+66]], $MachinePrecision]], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(z / N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-73} \lor \neg \left(y \leq 1.05 \cdot 10^{+66}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z}{\frac{t}{x}}\\
\end{array}
\end{array}
if y < -3e-73 or 1.05000000000000003e66 < y Initial program 88.4%
associate-*l/92.3%
Simplified92.3%
Taylor expanded in y around inf 86.1%
associate-*r/92.1%
Simplified92.1%
clear-num92.0%
un-div-inv92.2%
Applied egg-rr92.2%
if -3e-73 < y < 1.05000000000000003e66Initial program 92.7%
Taylor expanded in y around 0 86.3%
mul-1-neg86.3%
distribute-lft-neg-out86.3%
*-commutative86.3%
Simplified86.3%
div-inv86.2%
add-sqr-sqrt40.4%
sqrt-unprod52.7%
sqr-neg52.7%
sqrt-unprod24.9%
add-sqr-sqrt48.8%
distribute-rgt-neg-in48.8%
cancel-sign-sub-inv48.8%
div-inv48.8%
associate-/l*51.7%
add-sqr-sqrt24.9%
sqrt-unprod52.7%
sqr-neg52.7%
sqrt-unprod43.4%
add-sqr-sqrt87.7%
Applied egg-rr87.7%
Final simplification89.9%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.9e-69) (not (<= y 1.05e+66))) (+ x (/ y (/ t z))) (- x (* x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.9e-69) || !(y <= 1.05e+66)) {
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 ((y <= (-6.9d-69)) .or. (.not. (y <= 1.05d+66))) 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 ((y <= -6.9e-69) || !(y <= 1.05e+66)) {
tmp = x + (y / (t / z));
} else {
tmp = x - (x * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.9e-69) or not (y <= 1.05e+66): tmp = x + (y / (t / z)) else: tmp = x - (x * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.9e-69) || !(y <= 1.05e+66)) 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 ((y <= -6.9e-69) || ~((y <= 1.05e+66))) tmp = x + (y / (t / z)); else tmp = x - (x * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.9e-69], N[Not[LessEqual[y, 1.05e+66]], $MachinePrecision]], 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}\;y \leq -6.9 \cdot 10^{-69} \lor \neg \left(y \leq 1.05 \cdot 10^{+66}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \frac{z}{t}\\
\end{array}
\end{array}
if y < -6.8999999999999997e-69 or 1.05000000000000003e66 < y Initial program 88.4%
associate-*l/92.3%
Simplified92.3%
Taylor expanded in y around inf 86.1%
associate-*r/92.1%
Simplified92.1%
clear-num92.0%
un-div-inv92.2%
Applied egg-rr92.2%
if -6.8999999999999997e-69 < y < 1.05000000000000003e66Initial program 92.7%
associate-*l/96.4%
Simplified96.4%
Taylor expanded in y around 0 86.3%
associate-*r/89.2%
mul-1-neg89.2%
distribute-rgt-neg-in89.2%
Simplified89.2%
Final simplification90.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.3e+38) (not (<= z 3e-22))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.3e+38) || !(z <= 3e-22)) {
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 <= (-3.3d+38)) .or. (.not. (z <= 3d-22))) 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 <= -3.3e+38) || !(z <= 3e-22)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.3e+38) or not (z <= 3e-22): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.3e+38) || !(z <= 3e-22)) 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 <= -3.3e+38) || ~((z <= 3e-22))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.3e+38], N[Not[LessEqual[z, 3e-22]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+38} \lor \neg \left(z \leq 3 \cdot 10^{-22}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -3.2999999999999999e38 or 2.9999999999999999e-22 < z Initial program 85.0%
associate-*l/98.4%
Simplified98.4%
associate-*l/85.0%
associate-/l*97.3%
div-sub83.2%
associate-+r-83.2%
div-inv82.1%
clear-num82.2%
div-inv81.3%
clear-num81.3%
Applied egg-rr81.3%
Taylor expanded in x around 0 49.2%
associate-*l/57.3%
*-commutative57.3%
Simplified57.3%
if -3.2999999999999999e38 < z < 2.9999999999999999e-22Initial program 96.3%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in t around inf 67.1%
Final simplification62.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.05e+38) (* z (/ y t)) (if (<= z 3.65e-22) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+38) {
tmp = z * (y / t);
} else if (z <= 3.65e-22) {
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 <= (-2.05d+38)) then
tmp = z * (y / t)
else if (z <= 3.65d-22) 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 <= -2.05e+38) {
tmp = z * (y / t);
} else if (z <= 3.65e-22) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e+38: tmp = z * (y / t) elif z <= 3.65e-22: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+38) tmp = Float64(z * Float64(y / t)); elseif (z <= 3.65e-22) 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 <= -2.05e+38) tmp = z * (y / t); elseif (z <= 3.65e-22) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e+38], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.65e-22], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+38}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{elif}\;z \leq 3.65 \cdot 10^{-22}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -2.0500000000000002e38Initial program 86.7%
associate-*l/99.9%
Simplified99.9%
associate-*l/86.7%
associate-/l*98.0%
div-sub80.0%
associate-+r-80.0%
div-inv78.1%
clear-num78.1%
div-inv77.9%
clear-num78.0%
Applied egg-rr78.0%
Taylor expanded in x around 0 49.7%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
if -2.0500000000000002e38 < z < 3.65000000000000014e-22Initial program 96.3%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in t around inf 67.1%
if 3.65000000000000014e-22 < z Initial program 83.9%
associate-*l/97.4%
Simplified97.4%
associate-*l/83.9%
associate-/l*96.8%
div-sub85.2%
associate-+r-85.2%
div-inv84.6%
clear-num84.8%
div-inv83.4%
clear-num83.4%
Applied egg-rr83.4%
Taylor expanded in x around 0 48.8%
*-commutative48.8%
Simplified48.8%
associate-*l/60.7%
Applied egg-rr60.7%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (if (<= z -2.5e+38) (/ y (/ t z)) (if (<= z 1.55e-20) x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.5e+38) {
tmp = y / (t / z);
} else if (z <= 1.55e-20) {
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 <= (-2.5d+38)) then
tmp = y / (t / z)
else if (z <= 1.55d-20) 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 <= -2.5e+38) {
tmp = y / (t / z);
} else if (z <= 1.55e-20) {
tmp = x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.5e+38: tmp = y / (t / z) elif z <= 1.55e-20: tmp = x else: tmp = y * (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.5e+38) tmp = Float64(y / Float64(t / z)); elseif (z <= 1.55e-20) 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 <= -2.5e+38) tmp = y / (t / z); elseif (z <= 1.55e-20) tmp = x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.5e+38], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-20], x, N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+38}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if z < -2.49999999999999985e38Initial program 86.7%
associate-*l/99.9%
Simplified99.9%
associate-*l/86.7%
associate-/l*98.0%
div-sub80.0%
associate-+r-80.0%
div-inv78.1%
clear-num78.1%
div-inv77.9%
clear-num78.0%
Applied egg-rr78.0%
Taylor expanded in x around 0 49.7%
associate-*l/55.4%
*-commutative55.4%
Simplified55.4%
*-commutative55.4%
associate-/r/55.4%
Applied egg-rr55.4%
if -2.49999999999999985e38 < z < 1.55e-20Initial program 96.3%
associate-*l/90.4%
Simplified90.4%
Taylor expanded in t around inf 67.1%
if 1.55e-20 < z Initial program 83.9%
associate-*l/97.4%
Simplified97.4%
associate-*l/83.9%
associate-/l*96.8%
div-sub85.2%
associate-+r-85.2%
div-inv84.6%
clear-num84.8%
div-inv83.4%
clear-num83.4%
Applied egg-rr83.4%
Taylor expanded in x around 0 48.8%
*-commutative48.8%
Simplified48.8%
associate-*l/60.7%
Applied egg-rr60.7%
Final simplification62.9%
(FPCore (x y z t) :precision binary64 (+ x (* z (/ (- y x) t))))
double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / 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 + (z * ((y - x) / t))
end function
public static double code(double x, double y, double z, double t) {
return x + (z * ((y - x) / t));
}
def code(x, y, z, t): return x + (z * ((y - x) / t))
function code(x, y, z, t) return Float64(x + Float64(z * Float64(Float64(y - x) / t))) end
function tmp = code(x, y, z, t) tmp = x + (z * ((y - x) / t)); end
code[x_, y_, z_, t_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \frac{y - x}{t}
\end{array}
Initial program 90.6%
associate-*l/94.4%
Simplified94.4%
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 90.6%
associate-/l*97.5%
Simplified97.5%
Final simplification97.5%
(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 90.6%
associate-*l/94.4%
Simplified94.4%
Taylor expanded in t around inf 40.8%
Final simplification40.8%
(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 2023301
(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)))