
(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 10 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) (- 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 90.0%
associate-*l/96.9%
Simplified96.9%
Final simplification96.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- z))) (t_2 (/ t (/ a y))))
(if (<= t -3.5e+40)
t_2
(if (<= t 1e-282)
x
(if (<= t 2.95e-210)
t_1
(if (<= t 4e-147)
x
(if (<= t 1.15e-119) t_1 (if (<= t 1.55e+20) x t_2))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * -z;
double t_2 = t / (a / y);
double tmp;
if (t <= -3.5e+40) {
tmp = t_2;
} else if (t <= 1e-282) {
tmp = x;
} else if (t <= 2.95e-210) {
tmp = t_1;
} else if (t <= 4e-147) {
tmp = x;
} else if (t <= 1.15e-119) {
tmp = t_1;
} else if (t <= 1.55e+20) {
tmp = x;
} 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 = (y / a) * -z
t_2 = t / (a / y)
if (t <= (-3.5d+40)) then
tmp = t_2
else if (t <= 1d-282) then
tmp = x
else if (t <= 2.95d-210) then
tmp = t_1
else if (t <= 4d-147) then
tmp = x
else if (t <= 1.15d-119) then
tmp = t_1
else if (t <= 1.55d+20) then
tmp = x
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 = (y / a) * -z;
double t_2 = t / (a / y);
double tmp;
if (t <= -3.5e+40) {
tmp = t_2;
} else if (t <= 1e-282) {
tmp = x;
} else if (t <= 2.95e-210) {
tmp = t_1;
} else if (t <= 4e-147) {
tmp = x;
} else if (t <= 1.15e-119) {
tmp = t_1;
} else if (t <= 1.55e+20) {
tmp = x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * -z t_2 = t / (a / y) tmp = 0 if t <= -3.5e+40: tmp = t_2 elif t <= 1e-282: tmp = x elif t <= 2.95e-210: tmp = t_1 elif t <= 4e-147: tmp = x elif t <= 1.15e-119: tmp = t_1 elif t <= 1.55e+20: tmp = x else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(-z)) t_2 = Float64(t / Float64(a / y)) tmp = 0.0 if (t <= -3.5e+40) tmp = t_2; elseif (t <= 1e-282) tmp = x; elseif (t <= 2.95e-210) tmp = t_1; elseif (t <= 4e-147) tmp = x; elseif (t <= 1.15e-119) tmp = t_1; elseif (t <= 1.55e+20) tmp = x; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * -z; t_2 = t / (a / y); tmp = 0.0; if (t <= -3.5e+40) tmp = t_2; elseif (t <= 1e-282) tmp = x; elseif (t <= 2.95e-210) tmp = t_1; elseif (t <= 4e-147) tmp = x; elseif (t <= 1.15e-119) tmp = t_1; elseif (t <= 1.55e+20) tmp = x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * (-z)), $MachinePrecision]}, Block[{t$95$2 = N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.5e+40], t$95$2, If[LessEqual[t, 1e-282], x, If[LessEqual[t, 2.95e-210], t$95$1, If[LessEqual[t, 4e-147], x, If[LessEqual[t, 1.15e-119], t$95$1, If[LessEqual[t, 1.55e+20], x, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(-z\right)\\
t_2 := \frac{t}{\frac{a}{y}}\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{+40}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 10^{-282}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.95 \cdot 10^{-210}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4 \cdot 10^{-147}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-119}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+20}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if t < -3.4999999999999999e40 or 1.55e20 < t Initial program 86.2%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in t around inf 62.9%
associate-/l*70.8%
Simplified70.8%
if -3.4999999999999999e40 < t < 1e-282 or 2.9499999999999999e-210 < t < 3.9999999999999999e-147 or 1.14999999999999997e-119 < t < 1.55e20Initial program 95.9%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in x around inf 56.3%
if 1e-282 < t < 2.9499999999999999e-210 or 3.9999999999999999e-147 < t < 1.14999999999999997e-119Initial program 78.8%
associate-*l/91.9%
Simplified91.9%
Taylor expanded in z around inf 58.1%
mul-1-neg58.1%
associate-*l/74.6%
*-commutative74.6%
Simplified74.6%
Final simplification64.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t z))) (t_2 (- x (/ y (/ a z)))))
(if (<= z -1.4e+181)
(- x (/ (* y z) a))
(if (<= z -2.6e+118)
t_1
(if (<= z -2.9e+90)
t_2
(if (<= z 3.7e-34)
(+ x (* (/ y a) t))
(if (<= z 1.2e+129) t_2 t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double t_2 = x - (y / (a / z));
double tmp;
if (z <= -1.4e+181) {
tmp = x - ((y * z) / a);
} else if (z <= -2.6e+118) {
tmp = t_1;
} else if (z <= -2.9e+90) {
tmp = t_2;
} else if (z <= 3.7e-34) {
tmp = x + ((y / a) * t);
} else if (z <= 1.2e+129) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (y / a) * (t - z)
t_2 = x - (y / (a / z))
if (z <= (-1.4d+181)) then
tmp = x - ((y * z) / a)
else if (z <= (-2.6d+118)) then
tmp = t_1
else if (z <= (-2.9d+90)) then
tmp = t_2
else if (z <= 3.7d-34) then
tmp = x + ((y / a) * t)
else if (z <= 1.2d+129) then
tmp = t_2
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) * (t - z);
double t_2 = x - (y / (a / z));
double tmp;
if (z <= -1.4e+181) {
tmp = x - ((y * z) / a);
} else if (z <= -2.6e+118) {
tmp = t_1;
} else if (z <= -2.9e+90) {
tmp = t_2;
} else if (z <= 3.7e-34) {
tmp = x + ((y / a) * t);
} else if (z <= 1.2e+129) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (t - z) t_2 = x - (y / (a / z)) tmp = 0 if z <= -1.4e+181: tmp = x - ((y * z) / a) elif z <= -2.6e+118: tmp = t_1 elif z <= -2.9e+90: tmp = t_2 elif z <= 3.7e-34: tmp = x + ((y / a) * t) elif z <= 1.2e+129: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(t - z)) t_2 = Float64(x - Float64(y / Float64(a / z))) tmp = 0.0 if (z <= -1.4e+181) tmp = Float64(x - Float64(Float64(y * z) / a)); elseif (z <= -2.6e+118) tmp = t_1; elseif (z <= -2.9e+90) tmp = t_2; elseif (z <= 3.7e-34) tmp = Float64(x + Float64(Float64(y / a) * t)); elseif (z <= 1.2e+129) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (t - z); t_2 = x - (y / (a / z)); tmp = 0.0; if (z <= -1.4e+181) tmp = x - ((y * z) / a); elseif (z <= -2.6e+118) tmp = t_1; elseif (z <= -2.9e+90) tmp = t_2; elseif (z <= 3.7e-34) tmp = x + ((y / a) * t); elseif (z <= 1.2e+129) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e+181], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -2.6e+118], t$95$1, If[LessEqual[z, -2.9e+90], t$95$2, If[LessEqual[z, 3.7e-34], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.2e+129], t$95$2, t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(t - z\right)\\
t_2 := x - \frac{y}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{+181}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{elif}\;z \leq -2.6 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -2.9 \cdot 10^{+90}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-34}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{+129}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.39999999999999992e181Initial program 91.2%
associate-*l/91.8%
Simplified91.8%
Taylor expanded in z around inf 91.2%
if -1.39999999999999992e181 < z < -2.60000000000000016e118 or 1.1999999999999999e129 < z Initial program 84.2%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around 0 76.3%
associate-*r/76.3%
neg-mul-176.3%
distribute-rgt-neg-in76.3%
associate-*r/82.1%
Simplified82.1%
Taylor expanded in y around 0 76.3%
associate-/l*82.2%
associate-/r/89.8%
Simplified89.8%
if -2.60000000000000016e118 < z < -2.9000000000000001e90 or 3.69999999999999988e-34 < z < 1.1999999999999999e129Initial program 88.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 96.9%
if -2.9000000000000001e90 < z < 3.69999999999999988e-34Initial program 92.0%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in z around 0 85.3%
cancel-sign-sub-inv85.3%
metadata-eval85.3%
*-lft-identity85.3%
+-commutative85.3%
associate-*r/91.2%
Simplified91.2%
Final simplification91.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- x (/ y (/ a z)))))
(if (<= z -9.5e+87)
t_1
(if (<= z 1.2e-33)
(+ x (* (/ y a) t))
(if (<= z 9e+128) t_1 (* (/ y a) (- t z)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x - (y / (a / z));
double tmp;
if (z <= -9.5e+87) {
tmp = t_1;
} else if (z <= 1.2e-33) {
tmp = x + ((y / a) * t);
} else if (z <= 9e+128) {
tmp = t_1;
} else {
tmp = (y / a) * (t - 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 = x - (y / (a / z))
if (z <= (-9.5d+87)) then
tmp = t_1
else if (z <= 1.2d-33) then
tmp = x + ((y / a) * t)
else if (z <= 9d+128) then
tmp = t_1
else
tmp = (y / a) * (t - z)
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 / (a / z));
double tmp;
if (z <= -9.5e+87) {
tmp = t_1;
} else if (z <= 1.2e-33) {
tmp = x + ((y / a) * t);
} else if (z <= 9e+128) {
tmp = t_1;
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x - (y / (a / z)) tmp = 0 if z <= -9.5e+87: tmp = t_1 elif z <= 1.2e-33: tmp = x + ((y / a) * t) elif z <= 9e+128: tmp = t_1 else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) t_1 = Float64(x - Float64(y / Float64(a / z))) tmp = 0.0 if (z <= -9.5e+87) tmp = t_1; elseif (z <= 1.2e-33) tmp = Float64(x + Float64(Float64(y / a) * t)); elseif (z <= 9e+128) tmp = t_1; else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x - (y / (a / z)); tmp = 0.0; if (z <= -9.5e+87) tmp = t_1; elseif (z <= 1.2e-33) tmp = x + ((y / a) * t); elseif (z <= 9e+128) tmp = t_1; else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.5e+87], t$95$1, If[LessEqual[z, 1.2e-33], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+128], t$95$1, N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x - \frac{y}{\frac{a}{z}}\\
\mathbf{if}\;z \leq -9.5 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.2 \cdot 10^{-33}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+128}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if z < -9.4999999999999992e87 or 1.2e-33 < z < 9.0000000000000003e128Initial program 88.6%
associate-/l*94.3%
Simplified94.3%
Taylor expanded in z around inf 86.7%
if -9.4999999999999992e87 < z < 1.2e-33Initial program 92.0%
associate-*l/96.7%
Simplified96.7%
Taylor expanded in z around 0 85.3%
cancel-sign-sub-inv85.3%
metadata-eval85.3%
*-lft-identity85.3%
+-commutative85.3%
associate-*r/91.2%
Simplified91.2%
if 9.0000000000000003e128 < z Initial program 84.6%
associate-*l/97.1%
Simplified97.1%
Taylor expanded in x around 0 76.9%
associate-*r/76.9%
neg-mul-176.9%
distribute-rgt-neg-in76.9%
associate-*r/82.0%
Simplified82.0%
Taylor expanded in y around 0 76.9%
associate-/l*82.0%
associate-/r/89.5%
Simplified89.5%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -4e-100) (not (<= y 1.7e-59))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -4e-100) || !(y <= 1.7e-59)) {
tmp = y * ((t - 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 ((y <= (-4d-100)) .or. (.not. (y <= 1.7d-59))) then
tmp = y * ((t - 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 ((y <= -4e-100) || !(y <= 1.7e-59)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -4e-100) or not (y <= 1.7e-59): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -4e-100) || !(y <= 1.7e-59)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -4e-100) || ~((y <= 1.7e-59))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -4e-100], N[Not[LessEqual[y, 1.7e-59]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4 \cdot 10^{-100} \lor \neg \left(y \leq 1.7 \cdot 10^{-59}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -4.0000000000000001e-100 or 1.70000000000000009e-59 < y Initial program 85.2%
associate-*l/97.5%
Simplified97.5%
Taylor expanded in x around 0 67.0%
associate-*r/67.0%
neg-mul-167.0%
distribute-rgt-neg-in67.0%
associate-*r/79.5%
Simplified79.5%
Taylor expanded in z around 0 78.9%
+-commutative78.9%
mul-1-neg78.9%
sub-neg78.9%
div-sub79.5%
Simplified79.5%
if -4.0000000000000001e-100 < y < 1.70000000000000009e-59Initial program 98.0%
associate-*l/95.9%
Simplified95.9%
Taylor expanded in x around inf 61.9%
Final simplification72.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.2e+88) (not (<= z 8.2e+128))) (* (/ y a) (- t z)) (+ x (* (/ y a) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.2e+88) || !(z <= 8.2e+128)) {
tmp = (y / a) * (t - 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 <= (-5.2d+88)) .or. (.not. (z <= 8.2d+128))) then
tmp = (y / a) * (t - 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 <= -5.2e+88) || !(z <= 8.2e+128)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y / a) * t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.2e+88) or not (z <= 8.2e+128): tmp = (y / a) * (t - z) else: tmp = x + ((y / a) * t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.2e+88) || !(z <= 8.2e+128)) tmp = Float64(Float64(y / a) * Float64(t - 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 <= -5.2e+88) || ~((z <= 8.2e+128))) tmp = (y / a) * (t - z); else tmp = x + ((y / a) * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.2e+88], N[Not[LessEqual[z, 8.2e+128]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.2 \cdot 10^{+88} \lor \neg \left(z \leq 8.2 \cdot 10^{+128}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot t\\
\end{array}
\end{array}
if z < -5.2000000000000001e88 or 8.20000000000000023e128 < z Initial program 86.1%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around 0 71.3%
associate-*r/71.3%
neg-mul-171.3%
distribute-rgt-neg-in71.3%
associate-*r/75.4%
Simplified75.4%
Taylor expanded in y around 0 71.3%
associate-/l*75.3%
associate-/r/81.0%
Simplified81.0%
if -5.2000000000000001e88 < z < 8.20000000000000023e128Initial program 91.7%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in z around 0 82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
*-lft-identity82.8%
+-commutative82.8%
associate-*r/88.8%
Simplified88.8%
Final simplification86.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.3e+137) x (if (<= a 1.25e+87) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.3e+137) {
tmp = x;
} else if (a <= 1.25e+87) {
tmp = (y / a) * (t - 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 (a <= (-3.3d+137)) then
tmp = x
else if (a <= 1.25d+87) then
tmp = (y / a) * (t - 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 (a <= -3.3e+137) {
tmp = x;
} else if (a <= 1.25e+87) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.3e+137: tmp = x elif a <= 1.25e+87: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.3e+137) tmp = x; elseif (a <= 1.25e+87) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -3.3e+137) tmp = x; elseif (a <= 1.25e+87) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.3e+137], x, If[LessEqual[a, 1.25e+87], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.3 \cdot 10^{+137}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{+87}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.30000000000000003e137 or 1.24999999999999995e87 < a Initial program 81.3%
associate-*l/95.0%
Simplified95.0%
Taylor expanded in x around inf 66.8%
if -3.30000000000000003e137 < a < 1.24999999999999995e87Initial program 93.7%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around 0 71.7%
associate-*r/71.7%
neg-mul-171.7%
distribute-rgt-neg-in71.7%
associate-*r/70.8%
Simplified70.8%
Taylor expanded in y around 0 71.7%
associate-/l*71.0%
associate-/r/75.6%
Simplified75.6%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5e+41) (not (<= t 6.6e+19))) (* (/ y a) t) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5e+41) || !(t <= 6.6e+19)) {
tmp = (y / a) * 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 ((t <= (-5d+41)) .or. (.not. (t <= 6.6d+19))) then
tmp = (y / a) * 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 ((t <= -5e+41) || !(t <= 6.6e+19)) {
tmp = (y / a) * t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5e+41) or not (t <= 6.6e+19): tmp = (y / a) * t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5e+41) || !(t <= 6.6e+19)) tmp = Float64(Float64(y / a) * t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -5e+41) || ~((t <= 6.6e+19))) tmp = (y / a) * t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5e+41], N[Not[LessEqual[t, 6.6e+19]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5 \cdot 10^{+41} \lor \neg \left(t \leq 6.6 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{y}{a} \cdot t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -5.00000000000000022e41 or 6.6e19 < t Initial program 86.2%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in t around inf 62.9%
associate-*r/70.7%
Simplified70.7%
if -5.00000000000000022e41 < t < 6.6e19Initial program 93.2%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in x around inf 50.7%
Final simplification59.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -9e+41) (not (<= t 5.8e+19))) (/ t (/ a y)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9e+41) || !(t <= 5.8e+19)) {
tmp = t / (a / y);
} 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 ((t <= (-9d+41)) .or. (.not. (t <= 5.8d+19))) then
tmp = t / (a / y)
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 ((t <= -9e+41) || !(t <= 5.8e+19)) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -9e+41) or not (t <= 5.8e+19): tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9e+41) || !(t <= 5.8e+19)) tmp = Float64(t / Float64(a / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -9e+41) || ~((t <= 5.8e+19))) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -9e+41], N[Not[LessEqual[t, 5.8e+19]], $MachinePrecision]], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+41} \lor \neg \left(t \leq 5.8 \cdot 10^{+19}\right):\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -9.0000000000000002e41 or 5.8e19 < t Initial program 86.2%
associate-*l/97.2%
Simplified97.2%
Taylor expanded in t around inf 62.9%
associate-/l*70.8%
Simplified70.8%
if -9.0000000000000002e41 < t < 5.8e19Initial program 93.2%
associate-*l/96.6%
Simplified96.6%
Taylor expanded in x around inf 50.7%
Final simplification59.8%
(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 90.0%
associate-*l/96.9%
Simplified96.9%
Taylor expanded in x around inf 36.7%
Final simplification36.7%
(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 2023290
(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)))