
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
double code(double x, double y, double z, double t) {
return x + ((y * (z - 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 + ((y * (z - x)) / t)
end function
public static double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
def code(x, y, z, t): return x + ((y * (z - x)) / t)
function code(x, y, z, t) return Float64(x + Float64(Float64(y * Float64(z - x)) / t)) end
function tmp = code(x, y, z, t) tmp = x + ((y * (z - x)) / t); end
code[x_, y_, z_, t_] := N[(x + N[(N[(y * N[(z - x), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - x\right)}{t}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- z x) y) t))))
(if (<= t_1 (- INFINITY))
(+ x (* y (/ (- z x) t)))
(if (<= t_1 2e+302) t_1 (+ x (/ y (/ t (- z x))))))))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = x + (y * ((z - x) / t));
} else if (t_1 <= 2e+302) {
tmp = t_1;
} else {
tmp = x + (y / (t / (z - x)));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = x + (y * ((z - x) / t));
} else if (t_1 <= 2e+302) {
tmp = t_1;
} else {
tmp = x + (y / (t / (z - x)));
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if t_1 <= -math.inf: tmp = x + (y * ((z - x) / t)) elif t_1 <= 2e+302: tmp = t_1 else: tmp = x + (y / (t / (z - x))) return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(x + Float64(y * Float64(Float64(z - x) / t))); elseif (t_1 <= 2e+302) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if (t_1 <= -Inf) tmp = x + (y * ((z - x) / t)); elseif (t_1 <= 2e+302) tmp = t_1; else tmp = x + (y / (t / (z - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+302], t$95$1, N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+302}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0Initial program 73.6%
+-commutative73.6%
associate-/l*100.0%
fma-define100.0%
Simplified100.0%
fma-undefine100.0%
Applied egg-rr100.0%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.0000000000000002e302Initial program 98.6%
if 2.0000000000000002e302 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 67.1%
div-inv67.1%
*-commutative67.1%
associate-*l*99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l*99.8%
associate-/r/99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* (- z x) y) t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+302)))
(+ x (/ y (/ t (- z x))))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+302)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = x + (((z - x) * y) / t);
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+302)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x + (((z - x) * y) / t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+302): tmp = x + (y / (t / (z - x))) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x + Float64(Float64(Float64(z - x) * y) / t)) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+302)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x + (((z - x) * y) / t); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+302))) tmp = x + (y / (t / (z - x))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x + N[(N[(N[(z - x), $MachinePrecision] * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+302]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{\left(z - x\right) \cdot y}{t}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+302}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -inf.0 or 2.0000000000000002e302 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 70.1%
div-inv70.1%
*-commutative70.1%
associate-*l*99.8%
Applied egg-rr99.8%
*-commutative99.8%
associate-*l*99.9%
associate-/r/99.9%
un-div-inv99.9%
Applied egg-rr99.9%
if -inf.0 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.0000000000000002e302Initial program 98.6%
Final simplification99.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- 1.0 (/ y t)))))
(if (<= x -7e+18)
t_1
(if (<= x 3e+70)
(+ x (* z (/ y t)))
(if (<= x 2.2e+118)
(- x (* y (/ x t)))
(if (<= x 5.2e+149) (+ x (* y (/ z t))) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (1.0 - (y / t));
double tmp;
if (x <= -7e+18) {
tmp = t_1;
} else if (x <= 3e+70) {
tmp = x + (z * (y / t));
} else if (x <= 2.2e+118) {
tmp = x - (y * (x / t));
} else if (x <= 5.2e+149) {
tmp = x + (y * (z / t));
} 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 = x * (1.0d0 - (y / t))
if (x <= (-7d+18)) then
tmp = t_1
else if (x <= 3d+70) then
tmp = x + (z * (y / t))
else if (x <= 2.2d+118) then
tmp = x - (y * (x / t))
else if (x <= 5.2d+149) then
tmp = x + (y * (z / t))
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 = x * (1.0 - (y / t));
double tmp;
if (x <= -7e+18) {
tmp = t_1;
} else if (x <= 3e+70) {
tmp = x + (z * (y / t));
} else if (x <= 2.2e+118) {
tmp = x - (y * (x / t));
} else if (x <= 5.2e+149) {
tmp = x + (y * (z / t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (1.0 - (y / t)) tmp = 0 if x <= -7e+18: tmp = t_1 elif x <= 3e+70: tmp = x + (z * (y / t)) elif x <= 2.2e+118: tmp = x - (y * (x / t)) elif x <= 5.2e+149: tmp = x + (y * (z / t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(1.0 - Float64(y / t))) tmp = 0.0 if (x <= -7e+18) tmp = t_1; elseif (x <= 3e+70) tmp = Float64(x + Float64(z * Float64(y / t))); elseif (x <= 2.2e+118) tmp = Float64(x - Float64(y * Float64(x / t))); elseif (x <= 5.2e+149) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (1.0 - (y / t)); tmp = 0.0; if (x <= -7e+18) tmp = t_1; elseif (x <= 3e+70) tmp = x + (z * (y / t)); elseif (x <= 2.2e+118) tmp = x - (y * (x / t)); elseif (x <= 5.2e+149) tmp = x + (y * (z / t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+18], t$95$1, If[LessEqual[x, 3e+70], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e+118], N[(x - N[(y * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+149], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{if}\;x \leq -7 \cdot 10^{+18}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 3 \cdot 10^{+70}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{+118}:\\
\;\;\;\;x - y \cdot \frac{x}{t}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+149}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -7e18 or 5.19999999999999957e149 < x Initial program 85.6%
Taylor expanded in x around inf 93.5%
mul-1-neg93.5%
unsub-neg93.5%
Simplified93.5%
if -7e18 < x < 2.99999999999999976e70Initial program 91.6%
Taylor expanded in z around inf 86.6%
*-commutative86.6%
associate-*r/93.3%
Simplified93.3%
if 2.99999999999999976e70 < x < 2.19999999999999986e118Initial program 91.9%
Taylor expanded in x around inf 99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Taylor expanded in t around 0 67.9%
mul-1-neg67.9%
distribute-rgt-neg-out67.9%
+-commutative67.9%
*-commutative67.9%
distribute-lft-out67.9%
unsub-neg67.9%
Simplified67.9%
Taylor expanded in t around inf 91.9%
mul-1-neg91.9%
associate-*l/99.9%
*-commutative99.9%
unsub-neg99.9%
Simplified99.9%
if 2.19999999999999986e118 < x < 5.19999999999999957e149Initial program 86.4%
Taylor expanded in z around inf 86.4%
associate-/l*100.0%
Simplified100.0%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6e-229) (not (<= y 1.55e-131))) (+ x (/ y (/ t (- z x)))) (+ x (/ (* z y) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-229) || !(y <= 1.55e-131)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((y <= (-6d-229)) .or. (.not. (y <= 1.55d-131))) then
tmp = x + (y / (t / (z - x)))
else
tmp = x + ((z * y) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6e-229) || !(y <= 1.55e-131)) {
tmp = x + (y / (t / (z - x)));
} else {
tmp = x + ((z * y) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6e-229) or not (y <= 1.55e-131): tmp = x + (y / (t / (z - x))) else: tmp = x + ((z * y) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6e-229) || !(y <= 1.55e-131)) tmp = Float64(x + Float64(y / Float64(t / Float64(z - x)))); else tmp = Float64(x + Float64(Float64(z * y) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -6e-229) || ~((y <= 1.55e-131))) tmp = x + (y / (t / (z - x))); else tmp = x + ((z * y) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6e-229], N[Not[LessEqual[y, 1.55e-131]], $MachinePrecision]], N[(x + N[(y / N[(t / N[(z - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{-229} \lor \neg \left(y \leq 1.55 \cdot 10^{-131}\right):\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{t}\\
\end{array}
\end{array}
if y < -6.00000000000000005e-229 or 1.5500000000000001e-131 < y Initial program 86.6%
div-inv86.5%
*-commutative86.5%
associate-*l*99.2%
Applied egg-rr99.2%
*-commutative99.2%
associate-*l*96.7%
associate-/r/96.7%
un-div-inv97.1%
Applied egg-rr97.1%
if -6.00000000000000005e-229 < y < 1.5500000000000001e-131Initial program 99.8%
Taylor expanded in z around inf 99.8%
associate-/l*88.3%
Simplified88.3%
*-commutative88.3%
associate-*l/99.8%
Applied egg-rr99.8%
Final simplification97.6%
(FPCore (x y z t) :precision binary64 (if (or (<= x -3.8e+19) (not (<= x 3.05e+68))) (* x (- 1.0 (/ y t))) (+ x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e+19) || !(x <= 3.05e+68)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((x <= (-3.8d+19)) .or. (.not. (x <= 3.05d+68))) then
tmp = x * (1.0d0 - (y / t))
else
tmp = x + (z * (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -3.8e+19) || !(x <= 3.05e+68)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (z * (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -3.8e+19) or not (x <= 3.05e+68): tmp = x * (1.0 - (y / t)) else: tmp = x + (z * (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -3.8e+19) || !(x <= 3.05e+68)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(x + Float64(z * Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -3.8e+19) || ~((x <= 3.05e+68))) tmp = x * (1.0 - (y / t)); else tmp = x + (z * (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -3.8e+19], N[Not[LessEqual[x, 3.05e+68]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+19} \lor \neg \left(x \leq 3.05 \cdot 10^{+68}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -3.8e19 or 3.05e68 < x Initial program 86.3%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
unsub-neg91.1%
Simplified91.1%
if -3.8e19 < x < 3.05e68Initial program 91.6%
Taylor expanded in z around inf 86.6%
*-commutative86.6%
associate-*r/93.3%
Simplified93.3%
Final simplification92.3%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.9e+23) (not (<= x 1.85e+67))) (* x (- 1.0 (/ y t))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.9e+23) || !(x <= 1.85e+67)) {
tmp = x * (1.0 - (y / 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 <= (-4.9d+23)) .or. (.not. (x <= 1.85d+67))) then
tmp = x * (1.0d0 - (y / 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 <= -4.9e+23) || !(x <= 1.85e+67)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.9e+23) or not (x <= 1.85e+67): tmp = x * (1.0 - (y / t)) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.9e+23) || !(x <= 1.85e+67)) tmp = Float64(x * Float64(1.0 - Float64(y / 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 <= -4.9e+23) || ~((x <= 1.85e+67))) tmp = x * (1.0 - (y / t)); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.9e+23], N[Not[LessEqual[x, 1.85e+67]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{+23} \lor \neg \left(x \leq 1.85 \cdot 10^{+67}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.9000000000000003e23 or 1.8499999999999999e67 < x Initial program 86.3%
Taylor expanded in x around inf 91.1%
mul-1-neg91.1%
unsub-neg91.1%
Simplified91.1%
if -4.9000000000000003e23 < x < 1.8499999999999999e67Initial program 91.6%
Taylor expanded in z around inf 86.6%
associate-/l*89.4%
Simplified89.4%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.35e-139) (not (<= y 1.6e-25))) (* y (/ (- z x) t)) (* x (- 1.0 (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e-139) || !(y <= 1.6e-25)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (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 ((y <= (-1.35d-139)) .or. (.not. (y <= 1.6d-25))) then
tmp = y * ((z - x) / t)
else
tmp = x * (1.0d0 - (y / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.35e-139) || !(y <= 1.6e-25)) {
tmp = y * ((z - x) / t);
} else {
tmp = x * (1.0 - (y / t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.35e-139) or not (y <= 1.6e-25): tmp = y * ((z - x) / t) else: tmp = x * (1.0 - (y / t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.35e-139) || !(y <= 1.6e-25)) tmp = Float64(y * Float64(Float64(z - x) / t)); else tmp = Float64(x * Float64(1.0 - Float64(y / t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -1.35e-139) || ~((y <= 1.6e-25))) tmp = y * ((z - x) / t); else tmp = x * (1.0 - (y / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.35e-139], N[Not[LessEqual[y, 1.6e-25]], $MachinePrecision]], N[(y * N[(N[(z - x), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{-139} \lor \neg \left(y \leq 1.6 \cdot 10^{-25}\right):\\
\;\;\;\;y \cdot \frac{z - x}{t}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\end{array}
\end{array}
if y < -1.3499999999999999e-139 or 1.6000000000000001e-25 < y Initial program 83.1%
Taylor expanded in y around -inf 68.8%
associate-/l*78.2%
*-commutative78.2%
Applied egg-rr78.2%
if -1.3499999999999999e-139 < y < 1.6000000000000001e-25Initial program 98.0%
Taylor expanded in x around inf 82.2%
mul-1-neg82.2%
unsub-neg82.2%
Simplified82.2%
Final simplification79.8%
(FPCore (x y z t) :precision binary64 (if (or (<= x -2.65e-98) (not (<= x 1.35e-225))) (* x (- 1.0 (/ y t))) (* z (/ y t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -2.65e-98) || !(x <= 1.35e-225)) {
tmp = x * (1.0 - (y / t));
} 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 ((x <= (-2.65d-98)) .or. (.not. (x <= 1.35d-225))) then
tmp = x * (1.0d0 - (y / t))
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 ((x <= -2.65e-98) || !(x <= 1.35e-225)) {
tmp = x * (1.0 - (y / t));
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -2.65e-98) or not (x <= 1.35e-225): tmp = x * (1.0 - (y / t)) else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -2.65e-98) || !(x <= 1.35e-225)) tmp = Float64(x * Float64(1.0 - Float64(y / t))); else tmp = Float64(z * Float64(y / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -2.65e-98) || ~((x <= 1.35e-225))) tmp = x * (1.0 - (y / t)); else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -2.65e-98], N[Not[LessEqual[x, 1.35e-225]], $MachinePrecision]], N[(x * N[(1.0 - N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.65 \cdot 10^{-98} \lor \neg \left(x \leq 1.35 \cdot 10^{-225}\right):\\
\;\;\;\;x \cdot \left(1 - \frac{y}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if x < -2.65000000000000015e-98 or 1.34999999999999996e-225 < x Initial program 89.0%
Taylor expanded in x around inf 81.3%
mul-1-neg81.3%
unsub-neg81.3%
Simplified81.3%
if -2.65000000000000015e-98 < x < 1.34999999999999996e-225Initial program 89.6%
Taylor expanded in y around -inf 69.6%
Taylor expanded in z around inf 66.7%
*-commutative86.2%
associate-*r/93.2%
Simplified73.6%
Final simplification79.3%
(FPCore (x y z t) :precision binary64 (if (or (<= y -6.2e-140) (not (<= y 1.55e-25))) (* z (/ y t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -6.2e-140) || !(y <= 1.55e-25)) {
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 ((y <= (-6.2d-140)) .or. (.not. (y <= 1.55d-25))) 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 ((y <= -6.2e-140) || !(y <= 1.55e-25)) {
tmp = z * (y / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -6.2e-140) or not (y <= 1.55e-25): tmp = z * (y / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -6.2e-140) || !(y <= 1.55e-25)) 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 ((y <= -6.2e-140) || ~((y <= 1.55e-25))) tmp = z * (y / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -6.2e-140], N[Not[LessEqual[y, 1.55e-25]], $MachinePrecision]], N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.2 \cdot 10^{-140} \lor \neg \left(y \leq 1.55 \cdot 10^{-25}\right):\\
\;\;\;\;z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.1999999999999998e-140 or 1.54999999999999997e-25 < y Initial program 83.1%
Taylor expanded in y around -inf 68.8%
Taylor expanded in z around inf 45.9%
*-commutative61.9%
associate-*r/72.0%
Simplified54.1%
if -6.1999999999999998e-140 < y < 1.54999999999999997e-25Initial program 98.0%
Taylor expanded in y around 0 74.8%
Final simplification62.5%
(FPCore (x y z t) :precision binary64 (if (or (<= y -1.65e-139) (not (<= y 1.5e-25))) (* y (/ z t)) x))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -1.65e-139) || !(y <= 1.5e-25)) {
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 ((y <= (-1.65d-139)) .or. (.not. (y <= 1.5d-25))) 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 ((y <= -1.65e-139) || !(y <= 1.5e-25)) {
tmp = y * (z / t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -1.65e-139) or not (y <= 1.5e-25): tmp = y * (z / t) else: tmp = x return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -1.65e-139) || !(y <= 1.5e-25)) 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 ((y <= -1.65e-139) || ~((y <= 1.5e-25))) tmp = y * (z / t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -1.65e-139], N[Not[LessEqual[y, 1.5e-25]], $MachinePrecision]], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-139} \lor \neg \left(y \leq 1.5 \cdot 10^{-25}\right):\\
\;\;\;\;y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.65e-139 or 1.4999999999999999e-25 < y Initial program 83.1%
Taylor expanded in y around -inf 68.8%
Taylor expanded in z around inf 45.9%
associate-/l*69.1%
Simplified51.1%
if -1.65e-139 < y < 1.4999999999999999e-25Initial program 98.0%
Taylor expanded in y around 0 74.8%
Final simplification60.8%
(FPCore (x y z t) :precision binary64 (if (<= y -1.65e-139) (/ z (/ t y)) (if (<= y 1.8e-25) x (* z (/ y t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.65e-139) {
tmp = z / (t / y);
} else if (y <= 1.8e-25) {
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 (y <= (-1.65d-139)) then
tmp = z / (t / y)
else if (y <= 1.8d-25) 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 (y <= -1.65e-139) {
tmp = z / (t / y);
} else if (y <= 1.8e-25) {
tmp = x;
} else {
tmp = z * (y / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.65e-139: tmp = z / (t / y) elif y <= 1.8e-25: tmp = x else: tmp = z * (y / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.65e-139) tmp = Float64(z / Float64(t / y)); elseif (y <= 1.8e-25) 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 (y <= -1.65e-139) tmp = z / (t / y); elseif (y <= 1.8e-25) tmp = x; else tmp = z * (y / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.65e-139], N[(z / N[(t / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e-25], x, N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{-139}:\\
\;\;\;\;\frac{z}{\frac{t}{y}}\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{-25}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{y}{t}\\
\end{array}
\end{array}
if y < -1.65e-139Initial program 85.3%
Taylor expanded in y around -inf 66.1%
Taylor expanded in z around inf 48.1%
*-commutative68.7%
associate-*r/76.2%
Simplified53.4%
clear-num53.5%
un-div-inv53.6%
Applied egg-rr53.6%
if -1.65e-139 < y < 1.8e-25Initial program 98.0%
Taylor expanded in y around 0 74.8%
if 1.8e-25 < y Initial program 80.3%
Taylor expanded in y around -inf 72.3%
Taylor expanded in z around inf 43.1%
*-commutative53.5%
associate-*r/66.8%
Simplified55.0%
(FPCore (x y z t) :precision binary64 (+ x (* (- z x) (* y (/ 1.0 t)))))
double code(double x, double y, double z, double t) {
return x + ((z - x) * (y * (1.0 / 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 - x) * (y * (1.0d0 / t)))
end function
public static double code(double x, double y, double z, double t) {
return x + ((z - x) * (y * (1.0 / t)));
}
def code(x, y, z, t): return x + ((z - x) * (y * (1.0 / t)))
function code(x, y, z, t) return Float64(x + Float64(Float64(z - x) * Float64(y * Float64(1.0 / t)))) end
function tmp = code(x, y, z, t) tmp = x + ((z - x) * (y * (1.0 / t))); end
code[x_, y_, z_, t_] := N[(x + N[(N[(z - x), $MachinePrecision] * N[(y * N[(1.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(z - x\right) \cdot \left(y \cdot \frac{1}{t}\right)
\end{array}
Initial program 89.2%
div-inv89.1%
*-commutative89.1%
associate-*l*99.0%
Applied egg-rr99.0%
(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.2%
Taylor expanded in y around 0 42.5%
(FPCore (x y z t) :precision binary64 (- x (+ (* x (/ y t)) (* (- z) (/ y t)))))
double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / 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 - ((x * (y / t)) + (-z * (y / t)))
end function
public static double code(double x, double y, double z, double t) {
return x - ((x * (y / t)) + (-z * (y / t)));
}
def code(x, y, z, t): return x - ((x * (y / t)) + (-z * (y / t)))
function code(x, y, z, t) return Float64(x - Float64(Float64(x * Float64(y / t)) + Float64(Float64(-z) * Float64(y / t)))) end
function tmp = code(x, y, z, t) tmp = x - ((x * (y / t)) + (-z * (y / t))); end
code[x_, y_, z_, t_] := N[(x - N[(N[(x * N[(y / t), $MachinePrecision]), $MachinePrecision] + N[((-z) * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)
\end{array}
herbie shell --seed 2024085
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:alt
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))