
(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 8 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 (* (/ y a) (- z t))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (z - t));
}
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) * (z - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (z - t));
}
def code(x, y, z, t, a): return x + ((y / a) * (z - t))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(z - t))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (z - t)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(z - t\right)
\end{array}
Initial program 93.7%
associate-*l/97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (or (<= t -4.4e+45)
(not (or (<= t 8.4e+24) (and (not (<= t 1.4e+95)) (<= t 9.2e+174)))))
(* (/ y a) (- z t))
(+ x (* (/ y a) z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.4e+45) || !((t <= 8.4e+24) || (!(t <= 1.4e+95) && (t <= 9.2e+174)))) {
tmp = (y / a) * (z - t);
} else {
tmp = x + ((y / a) * z);
}
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 ((t <= (-4.4d+45)) .or. (.not. (t <= 8.4d+24) .or. (.not. (t <= 1.4d+95)) .and. (t <= 9.2d+174))) then
tmp = (y / a) * (z - t)
else
tmp = x + ((y / a) * z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.4e+45) || !((t <= 8.4e+24) || (!(t <= 1.4e+95) && (t <= 9.2e+174)))) {
tmp = (y / a) * (z - t);
} else {
tmp = x + ((y / a) * z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.4e+45) or not ((t <= 8.4e+24) or (not (t <= 1.4e+95) and (t <= 9.2e+174))): tmp = (y / a) * (z - t) else: tmp = x + ((y / a) * z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.4e+45) || !((t <= 8.4e+24) || (!(t <= 1.4e+95) && (t <= 9.2e+174)))) tmp = Float64(Float64(y / a) * Float64(z - t)); else tmp = Float64(x + Float64(Float64(y / a) * z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.4e+45) || ~(((t <= 8.4e+24) || (~((t <= 1.4e+95)) && (t <= 9.2e+174))))) tmp = (y / a) * (z - t); else tmp = x + ((y / a) * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.4e+45], N[Not[Or[LessEqual[t, 8.4e+24], And[N[Not[LessEqual[t, 1.4e+95]], $MachinePrecision], LessEqual[t, 9.2e+174]]]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.4 \cdot 10^{+45} \lor \neg \left(t \leq 8.4 \cdot 10^{+24} \lor \neg \left(t \leq 1.4 \cdot 10^{+95}\right) \land t \leq 9.2 \cdot 10^{+174}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\end{array}
\end{array}
if t < -4.4000000000000001e45 or 8.4000000000000005e24 < t < 1.3999999999999999e95 or 9.1999999999999991e174 < t Initial program 90.8%
associate-*l/99.0%
Simplified99.0%
associate-/r/89.9%
div-inv89.9%
associate-/r*98.8%
Applied egg-rr98.8%
flip-+29.2%
pow229.2%
div-inv29.2%
inv-pow29.2%
pow-flip29.2%
metadata-eval29.2%
pow129.2%
div-inv29.3%
inv-pow29.3%
pow-flip29.2%
metadata-eval29.2%
pow129.2%
Applied egg-rr29.2%
Taylor expanded in x around 0 70.3%
*-commutative70.3%
associate-*l/77.6%
*-commutative77.6%
Simplified77.6%
if -4.4000000000000001e45 < t < 8.4000000000000005e24 or 1.3999999999999999e95 < t < 9.1999999999999991e174Initial program 95.6%
associate-*l/96.8%
Simplified96.8%
Taylor expanded in t around 0 86.4%
associate-/l*85.8%
Simplified85.8%
associate-/r/87.0%
Applied egg-rr87.0%
Final simplification83.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- z t))))
(if (<= t -2.4e+48)
t_1
(if (<= t 8.4e+24)
(+ x (* (/ y a) z))
(if (or (<= t 1.95e+95) (not (<= t 1.02e+175)))
t_1
(+ x (/ y (/ a z))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (z - t);
double tmp;
if (t <= -2.4e+48) {
tmp = t_1;
} else if (t <= 8.4e+24) {
tmp = x + ((y / a) * z);
} else if ((t <= 1.95e+95) || !(t <= 1.02e+175)) {
tmp = t_1;
} else {
tmp = x + (y / (a / z));
}
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 = (y / a) * (z - t)
if (t <= (-2.4d+48)) then
tmp = t_1
else if (t <= 8.4d+24) then
tmp = x + ((y / a) * z)
else if ((t <= 1.95d+95) .or. (.not. (t <= 1.02d+175))) then
tmp = t_1
else
tmp = x + (y / (a / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (z - t);
double tmp;
if (t <= -2.4e+48) {
tmp = t_1;
} else if (t <= 8.4e+24) {
tmp = x + ((y / a) * z);
} else if ((t <= 1.95e+95) || !(t <= 1.02e+175)) {
tmp = t_1;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (z - t) tmp = 0 if t <= -2.4e+48: tmp = t_1 elif t <= 8.4e+24: tmp = x + ((y / a) * z) elif (t <= 1.95e+95) or not (t <= 1.02e+175): tmp = t_1 else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(z - t)) tmp = 0.0 if (t <= -2.4e+48) tmp = t_1; elseif (t <= 8.4e+24) tmp = Float64(x + Float64(Float64(y / a) * z)); elseif ((t <= 1.95e+95) || !(t <= 1.02e+175)) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (z - t); tmp = 0.0; if (t <= -2.4e+48) tmp = t_1; elseif (t <= 8.4e+24) tmp = x + ((y / a) * z); elseif ((t <= 1.95e+95) || ~((t <= 1.02e+175))) tmp = t_1; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.4e+48], t$95$1, If[LessEqual[t, 8.4e+24], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, 1.95e+95], N[Not[LessEqual[t, 1.02e+175]], $MachinePrecision]], t$95$1, N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{if}\;t \leq -2.4 \cdot 10^{+48}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{+24}:\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+95} \lor \neg \left(t \leq 1.02 \cdot 10^{+175}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -2.4000000000000001e48 or 8.4000000000000005e24 < t < 1.9499999999999999e95 or 1.0199999999999999e175 < t Initial program 90.8%
associate-*l/99.0%
Simplified99.0%
associate-/r/89.9%
div-inv89.9%
associate-/r*98.8%
Applied egg-rr98.8%
flip-+29.2%
pow229.2%
div-inv29.2%
inv-pow29.2%
pow-flip29.2%
metadata-eval29.2%
pow129.2%
div-inv29.3%
inv-pow29.3%
pow-flip29.2%
metadata-eval29.2%
pow129.2%
Applied egg-rr29.2%
Taylor expanded in x around 0 70.3%
*-commutative70.3%
associate-*l/77.6%
*-commutative77.6%
Simplified77.6%
if -2.4000000000000001e48 < t < 8.4000000000000005e24Initial program 96.4%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in t around 0 87.4%
associate-/l*85.4%
Simplified85.4%
associate-/r/87.4%
Applied egg-rr87.4%
if 1.9499999999999999e95 < t < 1.0199999999999999e175Initial program 89.8%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in t around 0 79.0%
associate-/l*89.2%
Simplified89.2%
Final simplification83.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) z)))
(if (<= z -3.5e+83)
t_1
(if (<= z 4.5e-278) x (if (<= z 1.7e+68) (* t (/ (- y) a)) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * z;
double tmp;
if (z <= -3.5e+83) {
tmp = t_1;
} else if (z <= 4.5e-278) {
tmp = x;
} else if (z <= 1.7e+68) {
tmp = t * (-y / 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 = (y / a) * z
if (z <= (-3.5d+83)) then
tmp = t_1
else if (z <= 4.5d-278) then
tmp = x
else if (z <= 1.7d+68) then
tmp = t * (-y / 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 = (y / a) * z;
double tmp;
if (z <= -3.5e+83) {
tmp = t_1;
} else if (z <= 4.5e-278) {
tmp = x;
} else if (z <= 1.7e+68) {
tmp = t * (-y / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * z tmp = 0 if z <= -3.5e+83: tmp = t_1 elif z <= 4.5e-278: tmp = x elif z <= 1.7e+68: tmp = t * (-y / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * z) tmp = 0.0 if (z <= -3.5e+83) tmp = t_1; elseif (z <= 4.5e-278) tmp = x; elseif (z <= 1.7e+68) tmp = Float64(t * Float64(Float64(-y) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * z; tmp = 0.0; if (z <= -3.5e+83) tmp = t_1; elseif (z <= 4.5e-278) tmp = x; elseif (z <= 1.7e+68) tmp = t * (-y / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[z, -3.5e+83], t$95$1, If[LessEqual[z, 4.5e-278], x, If[LessEqual[z, 1.7e+68], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot z\\
\mathbf{if}\;z \leq -3.5 \cdot 10^{+83}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-278}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+68}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.49999999999999977e83 or 1.70000000000000008e68 < z Initial program 89.7%
associate-*l/96.8%
Simplified96.8%
associate-/r/90.7%
div-inv90.7%
associate-/r*96.8%
Applied egg-rr96.8%
flip-+28.6%
pow228.6%
div-inv28.5%
inv-pow28.5%
pow-flip28.5%
metadata-eval28.5%
pow128.5%
div-inv28.5%
inv-pow28.5%
pow-flip28.5%
metadata-eval28.5%
pow128.5%
Applied egg-rr28.5%
Taylor expanded in x around 0 67.5%
*-commutative67.5%
associate-*l/71.5%
*-commutative71.5%
Simplified71.5%
Taylor expanded in z around inf 61.1%
associate-*l/63.5%
*-commutative63.5%
Simplified63.5%
if -3.49999999999999977e83 < z < 4.4999999999999998e-278Initial program 96.6%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 60.7%
if 4.4999999999999998e-278 < z < 1.70000000000000008e68Initial program 95.0%
associate-*l/98.7%
Simplified98.7%
associate-/r/92.6%
div-inv92.5%
associate-/r*98.6%
Applied egg-rr98.6%
Taylor expanded in z around 0 90.0%
fma-def90.0%
associate-*r/87.5%
fma-def87.5%
neg-mul-187.5%
+-commutative87.5%
sub-neg87.5%
*-commutative87.5%
associate-*l/90.0%
associate-*r/96.1%
Simplified96.1%
Taylor expanded in x around 0 57.2%
mul-1-neg57.2%
associate-*l/63.3%
*-commutative63.3%
distribute-rgt-neg-in63.3%
distribute-neg-frac63.3%
Simplified63.3%
Final simplification62.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.65e-19) (not (<= z 1.25e+68))) (+ x (* (/ y a) z)) (- x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e-19) || !(z <= 1.25e+68)) {
tmp = x + ((y / a) * z);
} else {
tmp = x - ((y / a) * t);
}
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 <= (-1.65d-19)) .or. (.not. (z <= 1.25d+68))) then
tmp = x + ((y / a) * z)
else
tmp = x - ((y / a) * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.65e-19) || !(z <= 1.25e+68)) {
tmp = x + ((y / a) * z);
} else {
tmp = x - ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.65e-19) or not (z <= 1.25e+68): tmp = x + ((y / a) * z) else: tmp = x - ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.65e-19) || !(z <= 1.25e+68)) tmp = Float64(x + Float64(Float64(y / a) * z)); else tmp = Float64(x - Float64(Float64(y / a) * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.65e-19) || ~((z <= 1.25e+68))) tmp = x + ((y / a) * z); else tmp = x - ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.65e-19], N[Not[LessEqual[z, 1.25e+68]], $MachinePrecision]], N[(x + N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-19} \lor \neg \left(z \leq 1.25 \cdot 10^{+68}\right):\\
\;\;\;\;x + \frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -1.6499999999999999e-19 or 1.2500000000000001e68 < z Initial program 91.5%
associate-*l/97.3%
Simplified97.3%
Taylor expanded in t around 0 82.4%
associate-/l*82.6%
Simplified82.6%
associate-/r/86.7%
Applied egg-rr86.7%
if -1.6499999999999999e-19 < z < 1.2500000000000001e68Initial program 95.4%
associate-*l/98.0%
Simplified98.0%
associate-/r/94.2%
div-inv94.1%
associate-/r*97.9%
Applied egg-rr97.9%
Taylor expanded in z around 0 90.8%
fma-def90.8%
associate-*r/89.5%
fma-def89.5%
neg-mul-189.5%
+-commutative89.5%
sub-neg89.5%
*-commutative89.5%
associate-*l/90.8%
associate-*r/95.3%
Simplified95.3%
Final simplification91.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.8e+25) x (if (<= a 2.9e+100) (* (/ y a) (- z t)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.8e+25) {
tmp = x;
} else if (a <= 2.9e+100) {
tmp = (y / a) * (z - t);
} 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 (a <= (-4.8d+25)) then
tmp = x
else if (a <= 2.9d+100) then
tmp = (y / a) * (z - t)
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 (a <= -4.8e+25) {
tmp = x;
} else if (a <= 2.9e+100) {
tmp = (y / a) * (z - t);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.8e+25: tmp = x elif a <= 2.9e+100: tmp = (y / a) * (z - t) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.8e+25) tmp = x; elseif (a <= 2.9e+100) tmp = Float64(Float64(y / a) * Float64(z - t)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -4.8e+25) tmp = x; elseif (a <= 2.9e+100) tmp = (y / a) * (z - t); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.8e+25], x, If[LessEqual[a, 2.9e+100], N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.8 \cdot 10^{+25}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.9 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{a} \cdot \left(z - t\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.79999999999999992e25 or 2.9e100 < a Initial program 88.4%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around inf 65.4%
if -4.79999999999999992e25 < a < 2.9e100Initial program 96.9%
associate-*l/98.7%
Simplified98.7%
associate-/r/89.4%
div-inv89.3%
associate-/r*98.6%
Applied egg-rr98.6%
flip-+27.1%
pow227.1%
div-inv27.1%
inv-pow27.1%
pow-flip27.1%
metadata-eval27.1%
pow127.1%
div-inv27.1%
inv-pow27.1%
pow-flip27.2%
metadata-eval27.2%
pow127.2%
Applied egg-rr27.2%
Taylor expanded in x around 0 72.8%
*-commutative72.8%
associate-*l/74.5%
*-commutative74.5%
Simplified74.5%
Final simplification71.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.1e+83) (not (<= z 2.9e+98))) (* (/ y a) z) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.1e+83) || !(z <= 2.9e+98)) {
tmp = (y / a) * z;
} 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 ((z <= (-1.1d+83)) .or. (.not. (z <= 2.9d+98))) then
tmp = (y / a) * z
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 ((z <= -1.1e+83) || !(z <= 2.9e+98)) {
tmp = (y / a) * z;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.1e+83) or not (z <= 2.9e+98): tmp = (y / a) * z else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.1e+83) || !(z <= 2.9e+98)) tmp = Float64(Float64(y / a) * z); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.1e+83) || ~((z <= 2.9e+98))) tmp = (y / a) * z; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.1e+83], N[Not[LessEqual[z, 2.9e+98]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * z), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.1 \cdot 10^{+83} \lor \neg \left(z \leq 2.9 \cdot 10^{+98}\right):\\
\;\;\;\;\frac{y}{a} \cdot z\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.09999999999999999e83 or 2.9000000000000001e98 < z Initial program 88.9%
associate-*l/96.6%
Simplified96.6%
associate-/r/89.9%
div-inv90.0%
associate-/r*96.5%
Applied egg-rr96.5%
flip-+26.1%
pow226.1%
div-inv26.0%
inv-pow26.0%
pow-flip26.0%
metadata-eval26.0%
pow126.0%
div-inv26.0%
inv-pow26.0%
pow-flip26.0%
metadata-eval26.0%
pow126.0%
Applied egg-rr26.0%
Taylor expanded in x around 0 69.4%
*-commutative69.4%
associate-*l/73.8%
*-commutative73.8%
Simplified73.8%
Taylor expanded in z around inf 63.6%
associate-*l/66.3%
*-commutative66.3%
Simplified66.3%
if -1.09999999999999999e83 < z < 2.9000000000000001e98Initial program 96.1%
associate-*l/98.2%
Simplified98.2%
Taylor expanded in x around inf 48.9%
Final simplification54.6%
(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 93.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 40.4%
Final simplification40.4%
(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 2023199
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))