
(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 13 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 (if (<= y 8.5e-135) (+ x (/ (* (- z t) y) a)) (+ x (/ y (/ a (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 8.5e-135) {
tmp = x + (((z - t) * y) / a);
} else {
tmp = x + (y / (a / (z - 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 (y <= 8.5d-135) then
tmp = x + (((z - t) * y) / a)
else
tmp = x + (y / (a / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 8.5e-135) {
tmp = x + (((z - t) * y) / a);
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 8.5e-135: tmp = x + (((z - t) * y) / a) else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 8.5e-135) tmp = Float64(x + Float64(Float64(Float64(z - t) * y) / a)); else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 8.5e-135) tmp = x + (((z - t) * y) / a); else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 8.5e-135], N[(x + N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8.5 \cdot 10^{-135}:\\
\;\;\;\;x + \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if y < 8.49999999999999942e-135Initial program 97.8%
if 8.49999999999999942e-135 < y Initial program 87.9%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification98.6%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.1e-80)
x
(if (<= a 1.75e-275)
(/ (* z y) a)
(if (<= a 1e+15)
(* t (/ y (- a)))
(if (<= a 3.6e+132) x (if (<= a 2.1e+214) (* y (/ z a)) x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.1e-80) {
tmp = x;
} else if (a <= 1.75e-275) {
tmp = (z * y) / a;
} else if (a <= 1e+15) {
tmp = t * (y / -a);
} else if (a <= 3.6e+132) {
tmp = x;
} else if (a <= 2.1e+214) {
tmp = y * (z / 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 (a <= (-1.1d-80)) then
tmp = x
else if (a <= 1.75d-275) then
tmp = (z * y) / a
else if (a <= 1d+15) then
tmp = t * (y / -a)
else if (a <= 3.6d+132) then
tmp = x
else if (a <= 2.1d+214) then
tmp = y * (z / 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 (a <= -1.1e-80) {
tmp = x;
} else if (a <= 1.75e-275) {
tmp = (z * y) / a;
} else if (a <= 1e+15) {
tmp = t * (y / -a);
} else if (a <= 3.6e+132) {
tmp = x;
} else if (a <= 2.1e+214) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.1e-80: tmp = x elif a <= 1.75e-275: tmp = (z * y) / a elif a <= 1e+15: tmp = t * (y / -a) elif a <= 3.6e+132: tmp = x elif a <= 2.1e+214: tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.1e-80) tmp = x; elseif (a <= 1.75e-275) tmp = Float64(Float64(z * y) / a); elseif (a <= 1e+15) tmp = Float64(t * Float64(y / Float64(-a))); elseif (a <= 3.6e+132) tmp = x; elseif (a <= 2.1e+214) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.1e-80) tmp = x; elseif (a <= 1.75e-275) tmp = (z * y) / a; elseif (a <= 1e+15) tmp = t * (y / -a); elseif (a <= 3.6e+132) tmp = x; elseif (a <= 2.1e+214) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.1e-80], x, If[LessEqual[a, 1.75e-275], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 1e+15], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.6e+132], x, If[LessEqual[a, 2.1e+214], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.1 \cdot 10^{-80}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.75 \cdot 10^{-275}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{elif}\;a \leq 10^{+15}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{elif}\;a \leq 3.6 \cdot 10^{+132}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.1 \cdot 10^{+214}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.10000000000000005e-80 or 1e15 < a < 3.60000000000000016e132 or 2.1000000000000001e214 < a Initial program 93.5%
associate-/l*98.5%
Simplified98.5%
Taylor expanded in x around inf 64.8%
if -1.10000000000000005e-80 < a < 1.74999999999999984e-275Initial program 99.0%
+-commutative99.0%
associate-/l*82.3%
fma-define82.4%
Simplified82.4%
fma-undefine82.3%
associate-*r/99.0%
*-commutative99.0%
associate-/l*98.3%
Applied egg-rr98.3%
Taylor expanded in z around inf 71.2%
Taylor expanded in y around inf 53.3%
if 1.74999999999999984e-275 < a < 1e15Initial program 98.4%
+-commutative98.4%
associate-/l*88.5%
fma-define88.5%
Simplified88.5%
fma-undefine88.5%
associate-*r/98.4%
*-commutative98.4%
associate-/l*98.4%
Applied egg-rr98.4%
Taylor expanded in z around 0 73.7%
associate-*l/66.7%
*-commutative66.7%
neg-mul-166.7%
sub-neg66.7%
associate-*r/73.7%
associate-*l/77.7%
*-commutative77.7%
Simplified77.7%
Taylor expanded in x around 0 55.4%
mul-1-neg55.4%
distribute-frac-neg55.4%
distribute-rgt-neg-in55.4%
associate-/l*59.4%
Simplified59.4%
if 3.60000000000000016e132 < a < 2.1000000000000001e214Initial program 57.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 99.8%
associate--l+99.8%
div-sub99.8%
Simplified99.8%
Taylor expanded in z around inf 50.3%
Final simplification60.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* t (- y)) a)))
(if (<= t -1.5e+273)
t_1
(if (<= t -2e+263)
(+ x (/ (* z y) a))
(if (<= t -3.3e+113)
(* t (/ y (- a)))
(if (<= t 1.15e+207) (+ x (* z (/ y a))) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (t * -y) / a;
double tmp;
if (t <= -1.5e+273) {
tmp = t_1;
} else if (t <= -2e+263) {
tmp = x + ((z * y) / a);
} else if (t <= -3.3e+113) {
tmp = t * (y / -a);
} else if (t <= 1.15e+207) {
tmp = x + (z * (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 = (t * -y) / a
if (t <= (-1.5d+273)) then
tmp = t_1
else if (t <= (-2d+263)) then
tmp = x + ((z * y) / a)
else if (t <= (-3.3d+113)) then
tmp = t * (y / -a)
else if (t <= 1.15d+207) then
tmp = x + (z * (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 = (t * -y) / a;
double tmp;
if (t <= -1.5e+273) {
tmp = t_1;
} else if (t <= -2e+263) {
tmp = x + ((z * y) / a);
} else if (t <= -3.3e+113) {
tmp = t * (y / -a);
} else if (t <= 1.15e+207) {
tmp = x + (z * (y / a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (t * -y) / a tmp = 0 if t <= -1.5e+273: tmp = t_1 elif t <= -2e+263: tmp = x + ((z * y) / a) elif t <= -3.3e+113: tmp = t * (y / -a) elif t <= 1.15e+207: tmp = x + (z * (y / a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(t * Float64(-y)) / a) tmp = 0.0 if (t <= -1.5e+273) tmp = t_1; elseif (t <= -2e+263) tmp = Float64(x + Float64(Float64(z * y) / a)); elseif (t <= -3.3e+113) tmp = Float64(t * Float64(y / Float64(-a))); elseif (t <= 1.15e+207) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (t * -y) / a; tmp = 0.0; if (t <= -1.5e+273) tmp = t_1; elseif (t <= -2e+263) tmp = x + ((z * y) / a); elseif (t <= -3.3e+113) tmp = t * (y / -a); elseif (t <= 1.15e+207) tmp = x + (z * (y / a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(t * (-y)), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t, -1.5e+273], t$95$1, If[LessEqual[t, -2e+263], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -3.3e+113], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e+207], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t \cdot \left(-y\right)}{a}\\
\mathbf{if}\;t \leq -1.5 \cdot 10^{+273}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2 \cdot 10^{+263}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{elif}\;t \leq -3.3 \cdot 10^{+113}:\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+207}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.5e273 or 1.14999999999999997e207 < t Initial program 87.2%
associate-/l*86.4%
Simplified86.4%
Taylor expanded in y around inf 79.2%
associate--l+79.2%
div-sub79.2%
Simplified79.2%
Taylor expanded in x around 0 73.1%
div-sub73.1%
Simplified73.1%
Taylor expanded in z around 0 80.2%
associate-*r/80.2%
mul-1-neg80.2%
distribute-lft-neg-out80.2%
*-commutative80.2%
Simplified80.2%
if -1.5e273 < t < -2.00000000000000003e263Initial program 100.0%
associate-/l*81.0%
Simplified81.0%
Taylor expanded in z around inf 100.0%
if -2.00000000000000003e263 < t < -3.3000000000000003e113Initial program 92.7%
+-commutative92.7%
associate-/l*92.5%
fma-define92.5%
Simplified92.5%
fma-undefine92.5%
associate-*r/92.7%
*-commutative92.7%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 92.7%
associate-*l/92.5%
*-commutative92.5%
neg-mul-192.5%
sub-neg92.5%
associate-*r/92.7%
associate-*l/99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around 0 77.2%
mul-1-neg77.2%
distribute-frac-neg77.2%
distribute-rgt-neg-in77.2%
associate-/l*84.4%
Simplified84.4%
if -3.3000000000000003e113 < t < 1.14999999999999997e207Initial program 95.2%
associate-/l*93.4%
Simplified93.4%
Taylor expanded in t around 0 78.5%
+-commutative78.5%
associate-/l*78.9%
Simplified78.9%
clear-num78.9%
un-div-inv79.4%
Applied egg-rr79.4%
Taylor expanded in y around 0 78.5%
associate-*l/84.5%
Simplified84.5%
Final simplification84.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4e+65) (not (<= t 2.4e+67))) (- x (* t (/ y a))) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4e+65) || !(t <= 2.4e+67)) {
tmp = x - (t * (y / 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 ((t <= (-4d+65)) .or. (.not. (t <= 2.4d+67))) then
tmp = x - (t * (y / 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 ((t <= -4e+65) || !(t <= 2.4e+67)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4e+65) or not (t <= 2.4e+67): tmp = x - (t * (y / a)) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4e+65) || !(t <= 2.4e+67)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4e+65) || ~((t <= 2.4e+67))) tmp = x - (t * (y / a)); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4e+65], N[Not[LessEqual[t, 2.4e+67]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+65} \lor \neg \left(t \leq 2.4 \cdot 10^{+67}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4e65 or 2.40000000000000002e67 < t Initial program 92.9%
+-commutative92.9%
associate-/l*89.2%
fma-define89.2%
Simplified89.2%
fma-undefine89.2%
associate-*r/92.9%
*-commutative92.9%
associate-/l*97.2%
Applied egg-rr97.2%
Taylor expanded in z around 0 85.4%
associate-*l/84.4%
*-commutative84.4%
neg-mul-184.4%
sub-neg84.4%
associate-*r/85.4%
associate-*l/88.8%
*-commutative88.8%
Simplified88.8%
if -4e65 < t < 2.40000000000000002e67Initial program 95.1%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in t around 0 84.0%
+-commutative84.0%
associate-/l*84.4%
Simplified84.4%
clear-num84.4%
un-div-inv85.2%
Applied egg-rr85.2%
Taylor expanded in y around 0 84.0%
associate-*l/88.1%
Simplified88.1%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -4e-9) (not (<= x 3.2e-115))) (+ x (/ (* z y) a)) (* y (/ (- z t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4e-9) || !(x <= 3.2e-115)) {
tmp = x + ((z * y) / a);
} else {
tmp = y * ((z - t) / 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 ((x <= (-4d-9)) .or. (.not. (x <= 3.2d-115))) then
tmp = x + ((z * y) / a)
else
tmp = y * ((z - t) / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -4e-9) || !(x <= 3.2e-115)) {
tmp = x + ((z * y) / a);
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -4e-9) or not (x <= 3.2e-115): tmp = x + ((z * y) / a) else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -4e-9) || !(x <= 3.2e-115)) tmp = Float64(x + Float64(Float64(z * y) / a)); else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -4e-9) || ~((x <= 3.2e-115))) tmp = x + ((z * y) / a); else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -4e-9], N[Not[LessEqual[x, 3.2e-115]], $MachinePrecision]], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-9} \lor \neg \left(x \leq 3.2 \cdot 10^{-115}\right):\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if x < -4.00000000000000025e-9 or 3.2e-115 < x Initial program 95.0%
associate-/l*91.4%
Simplified91.4%
Taylor expanded in z around inf 76.1%
if -4.00000000000000025e-9 < x < 3.2e-115Initial program 93.0%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in y around inf 91.6%
associate--l+91.6%
div-sub93.6%
Simplified93.6%
Taylor expanded in x around 0 78.5%
div-sub80.5%
Simplified80.5%
Final simplification77.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4.7e-132) (not (<= y 1.06e-32))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4.7e-132) || !(y <= 1.06e-32)) {
tmp = y * ((z - 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 <= (-4.7d-132)) .or. (.not. (y <= 1.06d-32))) then
tmp = y * ((z - 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 <= -4.7e-132) || !(y <= 1.06e-32)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4.7e-132) or not (y <= 1.06e-32): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4.7e-132) || !(y <= 1.06e-32)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4.7e-132) || ~((y <= 1.06e-32))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4.7e-132], N[Not[LessEqual[y, 1.06e-32]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.7 \cdot 10^{-132} \lor \neg \left(y \leq 1.06 \cdot 10^{-32}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.7000000000000002e-132 or 1.05999999999999994e-32 < y Initial program 91.1%
associate-/l*97.6%
Simplified97.6%
Taylor expanded in y around inf 95.0%
associate--l+95.0%
div-sub97.0%
Simplified97.0%
Taylor expanded in x around 0 71.7%
div-sub73.7%
Simplified73.7%
if -4.7000000000000002e-132 < y < 1.05999999999999994e-32Initial program 98.5%
associate-/l*84.8%
Simplified84.8%
Taylor expanded in x around inf 63.8%
Final simplification69.6%
(FPCore (x y z t a) :precision binary64 (if (<= x -9e-9) (+ x (* y (/ z a))) (if (<= x 1.55e-115) (* y (/ (- z t) a)) (+ x (/ (* z y) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -9e-9) {
tmp = x + (y * (z / a));
} else if (x <= 1.55e-115) {
tmp = 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 (x <= (-9d-9)) then
tmp = x + (y * (z / a))
else if (x <= 1.55d-115) then
tmp = 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 (x <= -9e-9) {
tmp = x + (y * (z / a));
} else if (x <= 1.55e-115) {
tmp = y * ((z - t) / a);
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -9e-9: tmp = x + (y * (z / a)) elif x <= 1.55e-115: tmp = y * ((z - t) / a) else: tmp = x + ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -9e-9) tmp = Float64(x + Float64(y * Float64(z / a))); elseif (x <= 1.55e-115) tmp = 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 (x <= -9e-9) tmp = x + (y * (z / a)); elseif (x <= 1.55e-115) tmp = y * ((z - t) / a); else tmp = x + ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -9e-9], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.55e-115], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{-9}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{elif}\;x \leq 1.55 \cdot 10^{-115}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if x < -8.99999999999999953e-9Initial program 92.5%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in t around 0 82.0%
+-commutative82.0%
associate-/l*83.7%
Simplified83.7%
if -8.99999999999999953e-9 < x < 1.55000000000000003e-115Initial program 93.0%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in y around inf 91.6%
associate--l+91.6%
div-sub93.6%
Simplified93.6%
Taylor expanded in x around 0 78.5%
div-sub80.5%
Simplified80.5%
if 1.55000000000000003e-115 < x Initial program 96.8%
associate-/l*88.3%
Simplified88.3%
Taylor expanded in z around inf 71.8%
Final simplification78.4%
(FPCore (x y z t a) :precision binary64 (if (<= x -1.6e-9) x (if (<= x 5.6e-70) (/ y (/ a z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1.6e-9) {
tmp = x;
} else if (x <= 5.6e-70) {
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 (x <= (-1.6d-9)) then
tmp = x
else if (x <= 5.6d-70) 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 (x <= -1.6e-9) {
tmp = x;
} else if (x <= 5.6e-70) {
tmp = y / (a / z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1.6e-9: tmp = x elif x <= 5.6e-70: tmp = y / (a / z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1.6e-9) tmp = x; elseif (x <= 5.6e-70) tmp = Float64(y / Float64(a / z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1.6e-9) tmp = x; elseif (x <= 5.6e-70) tmp = y / (a / z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1.6e-9], x, If[LessEqual[x, 5.6e-70], N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-9}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{-70}:\\
\;\;\;\;\frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1.60000000000000006e-9 or 5.5999999999999998e-70 < x Initial program 94.6%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in x around inf 60.2%
if -1.60000000000000006e-9 < x < 5.5999999999999998e-70Initial program 93.6%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in y around inf 91.4%
associate--l+91.4%
div-sub93.3%
Simplified93.3%
Taylor expanded in z around inf 40.7%
clear-num54.2%
un-div-inv54.6%
Applied egg-rr41.1%
(FPCore (x y z t a) :precision binary64 (if (<= x -6.8e-7) x (if (<= x 2.3e-70) (* y (/ z a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -6.8e-7) {
tmp = x;
} else if (x <= 2.3e-70) {
tmp = y * (z / 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 (x <= (-6.8d-7)) then
tmp = x
else if (x <= 2.3d-70) then
tmp = y * (z / 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 (x <= -6.8e-7) {
tmp = x;
} else if (x <= 2.3e-70) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -6.8e-7: tmp = x elif x <= 2.3e-70: tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -6.8e-7) tmp = x; elseif (x <= 2.3e-70) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -6.8e-7) tmp = x; elseif (x <= 2.3e-70) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -6.8e-7], x, If[LessEqual[x, 2.3e-70], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.8 \cdot 10^{-7}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-70}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -6.79999999999999948e-7 or 2.30000000000000001e-70 < x Initial program 94.6%
associate-/l*91.5%
Simplified91.5%
Taylor expanded in x around inf 60.2%
if -6.79999999999999948e-7 < x < 2.30000000000000001e-70Initial program 93.6%
associate-/l*93.3%
Simplified93.3%
Taylor expanded in y around inf 91.4%
associate--l+91.4%
div-sub93.3%
Simplified93.3%
Taylor expanded in z around inf 40.7%
(FPCore (x y z t a) :precision binary64 (+ (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + 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 = ((z - t) * (y / a)) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + x;
}
def code(x, y, z, t, a): return ((z - t) * (y / a)) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(z - t) * Float64(y / a)) + x) end
function tmp = code(x, y, z, t, a) tmp = ((z - t) * (y / a)) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(z - t\right) \cdot \frac{y}{a} + x
\end{array}
Initial program 94.2%
+-commutative94.2%
associate-/l*92.3%
fma-define92.3%
Simplified92.3%
fma-undefine92.3%
associate-*r/94.2%
*-commutative94.2%
associate-/l*97.3%
Applied egg-rr97.3%
(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(y / Float64(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[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a}{z - t}}
\end{array}
Initial program 94.2%
associate-/l*92.3%
Simplified92.3%
clear-num92.2%
un-div-inv93.6%
Applied egg-rr93.6%
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 94.2%
associate-/l*92.3%
Simplified92.3%
(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 94.2%
associate-/l*92.3%
Simplified92.3%
Taylor expanded in x around inf 40.6%
(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 2024108
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:alt
(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)))