
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x - ((z - t) / (a / y));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((z - t) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x - ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x - ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 92.9%
associate-*r/91.2%
Simplified91.2%
*-commutative91.2%
associate-*l/92.9%
associate-/l*98.4%
Applied egg-rr98.4%
Final simplification98.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ t a)))) (t_2 (* z (/ y (- a)))))
(if (<= z -1.2e+150)
t_2
(if (<= z 1.25e+71)
t_1
(if (<= z 9e+132)
t_2
(if (<= z 2.4e+180)
t_1
(if (<= z 4.4e+291) (* y (/ z (- a))) t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (t / a));
double t_2 = z * (y / -a);
double tmp;
if (z <= -1.2e+150) {
tmp = t_2;
} else if (z <= 1.25e+71) {
tmp = t_1;
} else if (z <= 9e+132) {
tmp = t_2;
} else if (z <= 2.4e+180) {
tmp = t_1;
} else if (z <= 4.4e+291) {
tmp = y * (z / -a);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x + (y * (t / a))
t_2 = z * (y / -a)
if (z <= (-1.2d+150)) then
tmp = t_2
else if (z <= 1.25d+71) then
tmp = t_1
else if (z <= 9d+132) then
tmp = t_2
else if (z <= 2.4d+180) then
tmp = t_1
else if (z <= 4.4d+291) then
tmp = y * (z / -a)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (t / a));
double t_2 = z * (y / -a);
double tmp;
if (z <= -1.2e+150) {
tmp = t_2;
} else if (z <= 1.25e+71) {
tmp = t_1;
} else if (z <= 9e+132) {
tmp = t_2;
} else if (z <= 2.4e+180) {
tmp = t_1;
} else if (z <= 4.4e+291) {
tmp = y * (z / -a);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (t / a)) t_2 = z * (y / -a) tmp = 0 if z <= -1.2e+150: tmp = t_2 elif z <= 1.25e+71: tmp = t_1 elif z <= 9e+132: tmp = t_2 elif z <= 2.4e+180: tmp = t_1 elif z <= 4.4e+291: tmp = y * (z / -a) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(t / a))) t_2 = Float64(z * Float64(y / Float64(-a))) tmp = 0.0 if (z <= -1.2e+150) tmp = t_2; elseif (z <= 1.25e+71) tmp = t_1; elseif (z <= 9e+132) tmp = t_2; elseif (z <= 2.4e+180) tmp = t_1; elseif (z <= 4.4e+291) tmp = Float64(y * Float64(z / Float64(-a))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (t / a)); t_2 = z * (y / -a); tmp = 0.0; if (z <= -1.2e+150) tmp = t_2; elseif (z <= 1.25e+71) tmp = t_1; elseif (z <= 9e+132) tmp = t_2; elseif (z <= 2.4e+180) tmp = t_1; elseif (z <= 4.4e+291) tmp = y * (z / -a); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+150], t$95$2, If[LessEqual[z, 1.25e+71], t$95$1, If[LessEqual[z, 9e+132], t$95$2, If[LessEqual[z, 2.4e+180], t$95$1, If[LessEqual[z, 4.4e+291], N[(y * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{t}{a}\\
t_2 := z \cdot \frac{y}{-a}\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+150}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{+71}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+132}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{+180}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+291}:\\
\;\;\;\;y \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.20000000000000001e150 or 1.24999999999999993e71 < z < 8.99999999999999944e132 or 4.3999999999999999e291 < z Initial program 89.5%
associate-*r/82.4%
Simplified82.4%
Taylor expanded in z around inf 63.2%
mul-1-neg63.2%
associate-*l/71.8%
*-commutative71.8%
distribute-rgt-neg-in71.8%
distribute-frac-neg71.8%
*-lft-identity71.8%
metadata-eval71.8%
times-frac71.8%
neg-mul-171.8%
remove-double-neg71.8%
neg-mul-171.8%
Simplified71.8%
if -1.20000000000000001e150 < z < 1.24999999999999993e71 or 8.99999999999999944e132 < z < 2.3999999999999998e180Initial program 94.3%
associate-*r/93.1%
Simplified93.1%
Taylor expanded in z around 0 83.2%
sub-neg83.2%
mul-1-neg83.2%
remove-double-neg83.2%
+-commutative83.2%
*-commutative83.2%
associate-/l*87.6%
associate-/r/82.9%
Simplified82.9%
if 2.3999999999999998e180 < z < 4.3999999999999999e291Initial program 86.6%
associate-*r/99.8%
Simplified99.8%
*-commutative99.8%
associate-*l/86.6%
associate-/l*93.1%
Applied egg-rr93.1%
Taylor expanded in z around inf 59.0%
associate-*r/59.0%
*-commutative59.0%
neg-mul-159.0%
distribute-rgt-neg-out59.0%
associate-/l*65.3%
remove-double-neg65.3%
distribute-frac-neg65.3%
neg-mul-165.3%
neg-mul-165.3%
times-frac65.3%
metadata-eval65.3%
*-commutative65.3%
*-rgt-identity65.3%
distribute-frac-neg65.3%
associate-/r/72.2%
*-commutative72.2%
Simplified72.2%
Final simplification80.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y (- a)))))
(if (<= z -5e+157)
t_1
(if (<= z 1.35e+71)
(+ x (/ (* t y) a))
(if (<= z 1.56e+131)
t_1
(if (<= z 7.4e+179)
(+ x (* y (/ t a)))
(if (<= z 1.35e+278) (* y (/ z (- a))) t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double tmp;
if (z <= -5e+157) {
tmp = t_1;
} else if (z <= 1.35e+71) {
tmp = x + ((t * y) / a);
} else if (z <= 1.56e+131) {
tmp = t_1;
} else if (z <= 7.4e+179) {
tmp = x + (y * (t / a));
} else if (z <= 1.35e+278) {
tmp = y * (z / -a);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = z * (y / -a)
if (z <= (-5d+157)) then
tmp = t_1
else if (z <= 1.35d+71) then
tmp = x + ((t * y) / a)
else if (z <= 1.56d+131) then
tmp = t_1
else if (z <= 7.4d+179) then
tmp = x + (y * (t / a))
else if (z <= 1.35d+278) then
tmp = y * (z / -a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / -a);
double tmp;
if (z <= -5e+157) {
tmp = t_1;
} else if (z <= 1.35e+71) {
tmp = x + ((t * y) / a);
} else if (z <= 1.56e+131) {
tmp = t_1;
} else if (z <= 7.4e+179) {
tmp = x + (y * (t / a));
} else if (z <= 1.35e+278) {
tmp = y * (z / -a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / -a) tmp = 0 if z <= -5e+157: tmp = t_1 elif z <= 1.35e+71: tmp = x + ((t * y) / a) elif z <= 1.56e+131: tmp = t_1 elif z <= 7.4e+179: tmp = x + (y * (t / a)) elif z <= 1.35e+278: tmp = y * (z / -a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / Float64(-a))) tmp = 0.0 if (z <= -5e+157) tmp = t_1; elseif (z <= 1.35e+71) tmp = Float64(x + Float64(Float64(t * y) / a)); elseif (z <= 1.56e+131) tmp = t_1; elseif (z <= 7.4e+179) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (z <= 1.35e+278) tmp = Float64(y * Float64(z / Float64(-a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / -a); tmp = 0.0; if (z <= -5e+157) tmp = t_1; elseif (z <= 1.35e+71) tmp = x + ((t * y) / a); elseif (z <= 1.56e+131) tmp = t_1; elseif (z <= 7.4e+179) tmp = x + (y * (t / a)); elseif (z <= 1.35e+278) tmp = y * (z / -a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+157], t$95$1, If[LessEqual[z, 1.35e+71], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.56e+131], t$95$1, If[LessEqual[z, 7.4e+179], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.35e+278], N[(y * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{-a}\\
\mathbf{if}\;z \leq -5 \cdot 10^{+157}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+71}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\mathbf{elif}\;z \leq 1.56 \cdot 10^{+131}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+179}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{+278}:\\
\;\;\;\;y \cdot \frac{z}{-a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -4.99999999999999976e157 or 1.34999999999999998e71 < z < 1.5600000000000001e131 or 1.35000000000000005e278 < z Initial program 89.5%
associate-*r/82.4%
Simplified82.4%
Taylor expanded in z around inf 63.2%
mul-1-neg63.2%
associate-*l/71.8%
*-commutative71.8%
distribute-rgt-neg-in71.8%
distribute-frac-neg71.8%
*-lft-identity71.8%
metadata-eval71.8%
times-frac71.8%
neg-mul-171.8%
remove-double-neg71.8%
neg-mul-171.8%
Simplified71.8%
if -4.99999999999999976e157 < z < 1.34999999999999998e71Initial program 94.1%
associate-*r/93.8%
Simplified93.8%
Taylor expanded in z around 0 83.4%
sub-neg83.4%
mul-1-neg83.4%
remove-double-neg83.4%
+-commutative83.4%
*-commutative83.4%
associate-/l*88.1%
associate-/r/83.2%
Simplified83.2%
associate-*l/83.4%
Applied egg-rr83.4%
if 1.5600000000000001e131 < z < 7.3999999999999999e179Initial program 100.0%
associate-*r/79.3%
Simplified79.3%
Taylor expanded in z around 0 78.3%
sub-neg78.3%
mul-1-neg78.3%
remove-double-neg78.3%
+-commutative78.3%
*-commutative78.3%
associate-/l*78.3%
associate-/r/78.3%
Simplified78.3%
if 7.3999999999999999e179 < z < 1.35000000000000005e278Initial program 86.6%
associate-*r/99.8%
Simplified99.8%
*-commutative99.8%
associate-*l/86.6%
associate-/l*93.1%
Applied egg-rr93.1%
Taylor expanded in z around inf 59.0%
associate-*r/59.0%
*-commutative59.0%
neg-mul-159.0%
distribute-rgt-neg-out59.0%
associate-/l*65.3%
remove-double-neg65.3%
distribute-frac-neg65.3%
neg-mul-165.3%
neg-mul-165.3%
times-frac65.3%
metadata-eval65.3%
*-commutative65.3%
*-rgt-identity65.3%
distribute-frac-neg65.3%
associate-/r/72.2%
*-commutative72.2%
Simplified72.2%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.2e-138) (not (<= y 1.05e-85))) (- x (* y (/ (- z t) a))) (- x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.2e-138) || !(y <= 1.05e-85)) {
tmp = x - (y * ((z - t) / a));
} else {
tmp = x - ((z * y) / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-2.2d-138)) .or. (.not. (y <= 1.05d-85))) then
tmp = x - (y * ((z - t) / a))
else
tmp = x - ((z * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.2e-138) || !(y <= 1.05e-85)) {
tmp = x - (y * ((z - t) / a));
} else {
tmp = x - ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.2e-138) or not (y <= 1.05e-85): tmp = x - (y * ((z - t) / a)) else: tmp = x - ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.2e-138) || !(y <= 1.05e-85)) tmp = Float64(x - Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x - Float64(Float64(z * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.2e-138) || ~((y <= 1.05e-85))) tmp = x - (y * ((z - t) / a)); else tmp = x - ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.2e-138], N[Not[LessEqual[y, 1.05e-85]], $MachinePrecision]], N[(x - N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.2 \cdot 10^{-138} \lor \neg \left(y \leq 1.05 \cdot 10^{-85}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if y < -2.1999999999999999e-138 or 1.05e-85 < y Initial program 89.3%
associate-*r/97.4%
Simplified97.4%
if -2.1999999999999999e-138 < y < 1.05e-85Initial program 99.9%
associate-*r/79.0%
Simplified79.0%
Taylor expanded in z around inf 91.0%
Final simplification95.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4e+17) (not (<= z 2.4e+41))) (- x (* z (/ y a))) (+ x (/ (* t y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e+17) || !(z <= 2.4e+41)) {
tmp = x - (z * (y / a));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-4d+17)) .or. (.not. (z <= 2.4d+41))) then
tmp = x - (z * (y / a))
else
tmp = x + ((t * y) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4e+17) || !(z <= 2.4e+41)) {
tmp = x - (z * (y / a));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4e+17) or not (z <= 2.4e+41): tmp = x - (z * (y / a)) else: tmp = x + ((t * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4e+17) || !(z <= 2.4e+41)) tmp = Float64(x - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4e+17) || ~((z <= 2.4e+41))) tmp = x - (z * (y / a)); else tmp = x + ((t * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4e+17], N[Not[LessEqual[z, 2.4e+41]], $MachinePrecision]], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{+17} \lor \neg \left(z \leq 2.4 \cdot 10^{+41}\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if z < -4e17 or 2.4000000000000002e41 < z Initial program 90.0%
associate-*r/88.3%
Simplified88.3%
Taylor expanded in z around inf 82.2%
associate-/l*80.6%
associate-/r/89.6%
Applied egg-rr89.6%
if -4e17 < z < 2.4000000000000002e41Initial program 95.2%
associate-*r/93.5%
Simplified93.5%
Taylor expanded in z around 0 89.1%
sub-neg89.1%
mul-1-neg89.1%
remove-double-neg89.1%
+-commutative89.1%
*-commutative89.1%
associate-/l*93.8%
associate-/r/87.4%
Simplified87.4%
associate-*l/89.1%
Applied egg-rr89.1%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.75e+17) (not (<= z 4.6e+41))) (- x (* z (/ y a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+17) || !(z <= 4.6e+41)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-2.75d+17)) .or. (.not. (z <= 4.6d+41))) then
tmp = x - (z * (y / a))
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.75e+17) || !(z <= 4.6e+41)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.75e+17) or not (z <= 4.6e+41): tmp = x - (z * (y / a)) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.75e+17) || !(z <= 4.6e+41)) tmp = Float64(x - Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.75e+17) || ~((z <= 4.6e+41))) tmp = x - (z * (y / a)); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.75e+17], N[Not[LessEqual[z, 4.6e+41]], $MachinePrecision]], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{+17} \lor \neg \left(z \leq 4.6 \cdot 10^{+41}\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -2.75e17 or 4.5999999999999997e41 < z Initial program 90.0%
associate-*r/88.3%
Simplified88.3%
Taylor expanded in z around inf 82.2%
associate-/l*80.6%
associate-/r/89.6%
Applied egg-rr89.6%
if -2.75e17 < z < 4.5999999999999997e41Initial program 95.2%
associate-*r/93.5%
Simplified93.5%
Taylor expanded in z around 0 89.1%
associate-*l/93.7%
neg-mul-193.7%
distribute-rgt-neg-out93.7%
Simplified93.7%
Final simplification91.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.85e-62) (not (<= y 8.5e-50))) (* y (/ t a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.85e-62) || !(y <= 8.5e-50)) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.85d-62)) .or. (.not. (y <= 8.5d-50))) then
tmp = y * (t / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.85e-62) || !(y <= 8.5e-50)) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.85e-62) or not (y <= 8.5e-50): tmp = y * (t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.85e-62) || !(y <= 8.5e-50)) tmp = Float64(y * Float64(t / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.85e-62) || ~((y <= 8.5e-50))) tmp = y * (t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.85e-62], N[Not[LessEqual[y, 8.5e-50]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-62} \lor \neg \left(y \leq 8.5 \cdot 10^{-50}\right):\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.8499999999999999e-62 or 8.50000000000000012e-50 < y Initial program 86.9%
associate-*r/97.5%
Simplified97.5%
Taylor expanded in t around inf 41.0%
*-commutative41.0%
associate-/l*47.8%
associate-/r/45.1%
Simplified45.1%
if -1.8499999999999999e-62 < y < 8.50000000000000012e-50Initial program 100.0%
associate-*r/83.8%
Simplified83.8%
Taylor expanded in x around inf 69.1%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.5e-61) (not (<= y 1.52e-49))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.5e-61) || !(y <= 1.52e-49)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-1.5d-61)) .or. (.not. (y <= 1.52d-49))) then
tmp = t * (y / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.5e-61) || !(y <= 1.52e-49)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.5e-61) or not (y <= 1.52e-49): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.5e-61) || !(y <= 1.52e-49)) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.5e-61) || ~((y <= 1.52e-49))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.5e-61], N[Not[LessEqual[y, 1.52e-49]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.5 \cdot 10^{-61} \lor \neg \left(y \leq 1.52 \cdot 10^{-49}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.50000000000000006e-61 or 1.52e-49 < y Initial program 86.9%
associate-*r/97.5%
Simplified97.5%
Taylor expanded in t around inf 41.0%
associate-/l*45.1%
associate-/r/48.4%
Applied egg-rr48.4%
if -1.50000000000000006e-61 < y < 1.52e-49Initial program 100.0%
associate-*r/83.8%
Simplified83.8%
Taylor expanded in x around inf 69.1%
Final simplification58.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -9.5e-63) (/ t (/ a y)) (if (<= y 1.52e-49) x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.5e-63) {
tmp = t / (a / y);
} else if (y <= 1.52e-49) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-9.5d-63)) then
tmp = t / (a / y)
else if (y <= 1.52d-49) then
tmp = x
else
tmp = t * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.5e-63) {
tmp = t / (a / y);
} else if (y <= 1.52e-49) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -9.5e-63: tmp = t / (a / y) elif y <= 1.52e-49: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -9.5e-63) tmp = Float64(t / Float64(a / y)); elseif (y <= 1.52e-49) tmp = x; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -9.5e-63) tmp = t / (a / y); elseif (y <= 1.52e-49) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -9.5e-63], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.52e-49], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{-63}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -9.50000000000000016e-63Initial program 86.7%
associate-*r/97.3%
Simplified97.3%
Taylor expanded in t around inf 37.8%
*-commutative37.8%
associate-/l*44.4%
associate-/r/41.8%
Simplified41.8%
associate-/r/44.4%
Applied egg-rr44.4%
if -9.50000000000000016e-63 < y < 1.52e-49Initial program 100.0%
associate-*r/83.8%
Simplified83.8%
Taylor expanded in x around inf 69.1%
if 1.52e-49 < y Initial program 87.1%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in t around inf 44.5%
associate-/l*48.7%
associate-/r/52.9%
Applied egg-rr52.9%
Final simplification58.0%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.55e-60) (* z (/ y (- a))) (if (<= y 1.52e-49) x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.55e-60) {
tmp = z * (y / -a);
} else if (y <= 1.52e-49) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (y <= (-1.55d-60)) then
tmp = z * (y / -a)
else if (y <= 1.52d-49) then
tmp = x
else
tmp = t * (y / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.55e-60) {
tmp = z * (y / -a);
} else if (y <= 1.52e-49) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.55e-60: tmp = z * (y / -a) elif y <= 1.52e-49: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.55e-60) tmp = Float64(z * Float64(y / Float64(-a))); elseif (y <= 1.52e-49) tmp = x; else tmp = Float64(t * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.55e-60) tmp = z * (y / -a); elseif (y <= 1.52e-49) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.55e-60], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.52e-49], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.55 \cdot 10^{-60}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;y \leq 1.52 \cdot 10^{-49}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -1.54999999999999994e-60Initial program 86.5%
associate-*r/98.6%
Simplified98.6%
Taylor expanded in z around inf 41.1%
mul-1-neg41.1%
associate-*l/46.5%
*-commutative46.5%
distribute-rgt-neg-in46.5%
distribute-frac-neg46.5%
*-lft-identity46.5%
metadata-eval46.5%
times-frac46.5%
neg-mul-146.5%
remove-double-neg46.5%
neg-mul-146.5%
Simplified46.5%
if -1.54999999999999994e-60 < y < 1.52e-49Initial program 99.9%
associate-*r/83.2%
Simplified83.2%
Taylor expanded in x around inf 68.6%
if 1.52e-49 < y Initial program 87.1%
associate-*r/97.7%
Simplified97.7%
Taylor expanded in t around inf 44.5%
associate-/l*48.7%
associate-/r/52.9%
Applied egg-rr52.9%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + ((y / a) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 92.9%
associate-*l/98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 92.9%
associate-*r/91.2%
Simplified91.2%
Taylor expanded in x around inf 42.9%
Final simplification42.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t_1}\\
\end{array}
\end{array}
herbie shell --seed 2023194
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))
(- x (/ (* y (- z t)) a)))