
(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 (or (<= y -3e-26) (not (<= y 2.3e-108))) (+ x (* y (/ (- t z) a))) (+ x (/ -1.0 (/ a (* y (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3e-26) || !(y <= 2.3e-108)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + (-1.0 / (a / (y * (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 <= (-3d-26)) .or. (.not. (y <= 2.3d-108))) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((-1.0d0) / (a / (y * (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 <= -3e-26) || !(y <= 2.3e-108)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + (-1.0 / (a / (y * (z - t))));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3e-26) or not (y <= 2.3e-108): tmp = x + (y * ((t - z) / a)) else: tmp = x + (-1.0 / (a / (y * (z - t)))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3e-26) || !(y <= 2.3e-108)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(-1.0 / Float64(a / Float64(y * Float64(z - t))))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3e-26) || ~((y <= 2.3e-108))) tmp = x + (y * ((t - z) / a)); else tmp = x + (-1.0 / (a / (y * (z - t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3e-26], N[Not[LessEqual[y, 2.3e-108]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-1.0 / N[(a / N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3 \cdot 10^{-26} \lor \neg \left(y \leq 2.3 \cdot 10^{-108}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{-1}{\frac{a}{y \cdot \left(z - t\right)}}\\
\end{array}
\end{array}
if y < -3.00000000000000012e-26 or 2.29999999999999996e-108 < y Initial program 88.2%
associate-/l*99.8%
Simplified99.8%
if -3.00000000000000012e-26 < y < 2.29999999999999996e-108Initial program 99.5%
associate-/l*85.5%
Simplified85.5%
associate-*r/99.5%
clear-num99.6%
Applied egg-rr99.6%
Final simplification99.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.85e-7) (not (<= y 3e-108))) (+ x (* y (/ (- t z) a))) (+ x (/ (* y (- t z)) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.85e-7) || !(y <= 3e-108)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y * (t - z)) / 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.85d-7)) .or. (.not. (y <= 3d-108))) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((y * (t - z)) / 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.85e-7) || !(y <= 3e-108)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y * (t - z)) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.85e-7) or not (y <= 3e-108): tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y * (t - z)) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.85e-7) || !(y <= 3e-108)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.85e-7) || ~((y <= 3e-108))) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y * (t - z)) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.85e-7], N[Not[LessEqual[y, 3e-108]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.85 \cdot 10^{-7} \lor \neg \left(y \leq 3 \cdot 10^{-108}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\end{array}
\end{array}
if y < -1.85000000000000002e-7 or 2.99999999999999993e-108 < y Initial program 87.8%
associate-/l*99.8%
Simplified99.8%
if -1.85000000000000002e-7 < y < 2.99999999999999993e-108Initial program 99.6%
Final simplification99.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.1e-124) (not (<= y 9.5e-216))) (+ x (* y (/ (- t z) a))) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.1e-124) || !(y <= 9.5e-216)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y * 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 ((y <= (-1.1d-124)) .or. (.not. (y <= 9.5d-216))) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((y * 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 ((y <= -1.1e-124) || !(y <= 9.5e-216)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.1e-124) or not (y <= 9.5e-216): tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.1e-124) || !(y <= 9.5e-216)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.1e-124) || ~((y <= 9.5e-216))) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.1e-124], N[Not[LessEqual[y, 9.5e-216]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-124} \lor \neg \left(y \leq 9.5 \cdot 10^{-216}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if y < -1.0999999999999999e-124 or 9.49999999999999943e-216 < y Initial program 91.3%
associate-/l*98.4%
Simplified98.4%
if -1.0999999999999999e-124 < y < 9.49999999999999943e-216Initial program 99.3%
associate-/l*77.7%
Simplified77.7%
Taylor expanded in z around 0 92.0%
associate-*r/92.0%
mul-1-neg92.0%
distribute-lft-neg-out92.0%
*-commutative92.0%
Simplified92.0%
Final simplification96.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -1.7e+72) (* y (/ (- t z) a)) (if (<= y 3.8e+89) (+ x (/ (* y t) a)) (* y (* (- z t) (/ -1.0 a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.7e+72) {
tmp = y * ((t - z) / a);
} else if (y <= 3.8e+89) {
tmp = x + ((y * t) / a);
} else {
tmp = y * ((z - t) * (-1.0 / 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.7d+72)) then
tmp = y * ((t - z) / a)
else if (y <= 3.8d+89) then
tmp = x + ((y * t) / a)
else
tmp = y * ((z - t) * ((-1.0d0) / 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.7e+72) {
tmp = y * ((t - z) / a);
} else if (y <= 3.8e+89) {
tmp = x + ((y * t) / a);
} else {
tmp = y * ((z - t) * (-1.0 / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.7e+72: tmp = y * ((t - z) / a) elif y <= 3.8e+89: tmp = x + ((y * t) / a) else: tmp = y * ((z - t) * (-1.0 / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.7e+72) tmp = Float64(y * Float64(Float64(t - z) / a)); elseif (y <= 3.8e+89) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(y * Float64(Float64(z - t) * Float64(-1.0 / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.7e+72) tmp = y * ((t - z) / a); elseif (y <= 3.8e+89) tmp = x + ((y * t) / a); else tmp = y * ((z - t) * (-1.0 / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.7e+72], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.8e+89], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - t), $MachinePrecision] * N[(-1.0 / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+89}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(z - t\right) \cdot \frac{-1}{a}\right)\\
\end{array}
\end{array}
if y < -1.6999999999999999e72Initial program 84.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 95.9%
Taylor expanded in a around 0 82.9%
associate-/l*98.0%
*-commutative98.0%
Applied egg-rr98.0%
if -1.6999999999999999e72 < y < 3.80000000000000023e89Initial program 97.8%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in z around 0 82.8%
associate-*r/82.8%
mul-1-neg82.8%
distribute-lft-neg-out82.8%
*-commutative82.8%
Simplified82.8%
if 3.80000000000000023e89 < y Initial program 86.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 70.1%
mul-1-neg70.1%
distribute-frac-neg270.1%
associate-*r/83.6%
Simplified83.6%
div-sub81.5%
sub-neg81.5%
distribute-frac-neg81.5%
frac-2neg81.5%
+-commutative81.5%
distribute-frac-neg281.5%
sub-neg81.5%
div-inv81.5%
div-inv81.5%
distribute-rgt-out--83.6%
Applied egg-rr83.6%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.65e+72) (not (<= y 9.2e+85))) (* y (/ (- t z) a)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.65e+72) || !(y <= 9.2e+85)) {
tmp = y * ((t - z) / a);
} else {
tmp = x + ((y * 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 ((y <= (-1.65d+72)) .or. (.not. (y <= 9.2d+85))) then
tmp = y * ((t - z) / a)
else
tmp = x + ((y * 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 ((y <= -1.65e+72) || !(y <= 9.2e+85)) {
tmp = y * ((t - z) / a);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.65e+72) or not (y <= 9.2e+85): tmp = y * ((t - z) / a) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.65e+72) || !(y <= 9.2e+85)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.65e+72) || ~((y <= 9.2e+85))) tmp = y * ((t - z) / a); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.65e+72], N[Not[LessEqual[y, 9.2e+85]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.65 \cdot 10^{+72} \lor \neg \left(y \leq 9.2 \cdot 10^{+85}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if y < -1.65e72 or 9.1999999999999996e85 < y Initial program 85.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 88.8%
Taylor expanded in a around 0 76.6%
associate-/l*90.8%
*-commutative90.8%
Applied egg-rr90.8%
if -1.65e72 < y < 9.1999999999999996e85Initial program 97.8%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in z around 0 82.8%
associate-*r/82.8%
mul-1-neg82.8%
distribute-lft-neg-out82.8%
*-commutative82.8%
Simplified82.8%
Final simplification85.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.6e+72) (not (<= y 4.5e+102))) (* y (/ (- t z) a)) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.6e+72) || !(y <= 4.5e+102)) {
tmp = y * ((t - z) / 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 ((y <= (-1.6d+72)) .or. (.not. (y <= 4.5d+102))) then
tmp = y * ((t - z) / 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 ((y <= -1.6e+72) || !(y <= 4.5e+102)) {
tmp = y * ((t - z) / a);
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.6e+72) or not (y <= 4.5e+102): tmp = y * ((t - z) / a) else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.6e+72) || !(y <= 4.5e+102)) tmp = Float64(y * Float64(Float64(t - z) / 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 ((y <= -1.6e+72) || ~((y <= 4.5e+102))) tmp = y * ((t - z) / a); else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.6e+72], N[Not[LessEqual[y, 4.5e+102]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+72} \lor \neg \left(y \leq 4.5 \cdot 10^{+102}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -1.6000000000000001e72 or 4.50000000000000021e102 < y Initial program 85.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 89.3%
Taylor expanded in a around 0 76.6%
associate-/l*91.5%
*-commutative91.5%
Applied egg-rr91.5%
if -1.6000000000000001e72 < y < 4.50000000000000021e102Initial program 97.8%
associate-*r/90.0%
*-commutative90.0%
div-inv89.9%
associate-*l*95.7%
Applied egg-rr95.7%
Taylor expanded in z around 0 81.7%
neg-mul-181.7%
Simplified81.7%
cancel-sign-sub81.7%
associate-*l/81.7%
*-un-lft-identity81.7%
+-commutative81.7%
Applied egg-rr81.7%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.5e-141) (not (<= y 3.5e-97))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.5e-141) || !(y <= 3.5e-97)) {
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 <= (-7.5d-141)) .or. (.not. (y <= 3.5d-97))) 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 <= -7.5e-141) || !(y <= 3.5e-97)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -7.5e-141) or not (y <= 3.5e-97): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.5e-141) || !(y <= 3.5e-97)) 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 <= -7.5e-141) || ~((y <= 3.5e-97))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.5e-141], N[Not[LessEqual[y, 3.5e-97]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.5 \cdot 10^{-141} \lor \neg \left(y \leq 3.5 \cdot 10^{-97}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.50000000000000046e-141 or 3.50000000000000019e-97 < y Initial program 90.0%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in y around inf 73.5%
Taylor expanded in a around 0 67.7%
associate-/l*76.4%
*-commutative76.4%
Applied egg-rr76.4%
if -7.50000000000000046e-141 < y < 3.50000000000000019e-97Initial program 99.5%
associate-/l*82.0%
Simplified82.0%
Taylor expanded in x around inf 63.9%
Final simplification72.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -6.1e-145) (not (<= y 5.4e-98))) (* (- t z) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -6.1e-145) || !(y <= 5.4e-98)) {
tmp = (t - z) * (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 <= (-6.1d-145)) .or. (.not. (y <= 5.4d-98))) then
tmp = (t - z) * (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 <= -6.1e-145) || !(y <= 5.4e-98)) {
tmp = (t - z) * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -6.1e-145) or not (y <= 5.4e-98): tmp = (t - z) * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -6.1e-145) || !(y <= 5.4e-98)) tmp = Float64(Float64(t - z) * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -6.1e-145) || ~((y <= 5.4e-98))) tmp = (t - z) * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -6.1e-145], N[Not[LessEqual[y, 5.4e-98]], $MachinePrecision]], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.1 \cdot 10^{-145} \lor \neg \left(y \leq 5.4 \cdot 10^{-98}\right):\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -6.1e-145 or 5.3999999999999997e-98 < y Initial program 90.1%
associate-/l*98.8%
Simplified98.8%
Taylor expanded in x around 0 67.5%
associate-*r/67.5%
neg-mul-167.5%
*-commutative67.5%
distribute-lft-neg-in67.5%
associate-*r/74.0%
*-commutative74.0%
neg-sub074.0%
sub-neg74.0%
+-commutative74.0%
associate--r+74.0%
neg-sub074.0%
remove-double-neg74.0%
Simplified74.0%
if -6.1e-145 < y < 5.3999999999999997e-98Initial program 99.5%
associate-/l*82.7%
Simplified82.7%
Taylor expanded in x around inf 64.3%
Final simplification70.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.25e+63) (not (<= y 2.45e+14))) (* z (/ y (- a))) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.25e+63) || !(y <= 2.45e+14)) {
tmp = z * (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 <= (-3.25d+63)) .or. (.not. (y <= 2.45d+14))) then
tmp = z * (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 <= -3.25e+63) || !(y <= 2.45e+14)) {
tmp = z * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.25e+63) or not (y <= 2.45e+14): tmp = z * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.25e+63) || !(y <= 2.45e+14)) tmp = Float64(z * Float64(y / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3.25e+63) || ~((y <= 2.45e+14))) tmp = z * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.25e+63], N[Not[LessEqual[y, 2.45e+14]], $MachinePrecision]], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.25 \cdot 10^{+63} \lor \neg \left(y \leq 2.45 \cdot 10^{+14}\right):\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.24999999999999996e63 or 2.45e14 < y Initial program 86.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 49.7%
mul-1-neg49.7%
associate-/l*56.7%
distribute-rgt-neg-in56.7%
distribute-frac-neg256.7%
Simplified56.7%
associate-*r/49.7%
distribute-frac-neg249.7%
*-commutative49.7%
add-sqr-sqrt24.4%
sqrt-unprod27.3%
sqr-neg27.3%
sqrt-unprod4.1%
add-sqr-sqrt6.6%
associate-*l/6.7%
div-inv6.7%
associate-*l*8.5%
add-sqr-sqrt5.9%
sqrt-unprod30.1%
sqr-neg30.1%
sqrt-unprod29.6%
add-sqr-sqrt59.4%
*-commutative59.4%
div-inv59.4%
Applied egg-rr59.4%
if -3.24999999999999996e63 < y < 2.45e14Initial program 97.7%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in x around inf 56.2%
Final simplification57.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.35e+61) (* z (/ y (- a))) (if (<= y 9.5e+16) x (/ z (/ a (- y))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.35e+61) {
tmp = z * (y / -a);
} else if (y <= 9.5e+16) {
tmp = x;
} else {
tmp = z / (a / -y);
}
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.35d+61)) then
tmp = z * (y / -a)
else if (y <= 9.5d+16) then
tmp = x
else
tmp = z / (a / -y)
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.35e+61) {
tmp = z * (y / -a);
} else if (y <= 9.5e+16) {
tmp = x;
} else {
tmp = z / (a / -y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.35e+61: tmp = z * (y / -a) elif y <= 9.5e+16: tmp = x else: tmp = z / (a / -y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.35e+61) tmp = Float64(z * Float64(y / Float64(-a))); elseif (y <= 9.5e+16) tmp = x; else tmp = Float64(z / Float64(a / Float64(-y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.35e+61) tmp = z * (y / -a); elseif (y <= 9.5e+16) tmp = x; else tmp = z / (a / -y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.35e+61], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+16], x, N[(z / N[(a / (-y)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{+61}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{z}{\frac{a}{-y}}\\
\end{array}
\end{array}
if y < -2.3499999999999999e61Initial program 85.1%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 61.5%
mul-1-neg61.5%
associate-/l*68.8%
distribute-rgt-neg-in68.8%
distribute-frac-neg268.8%
Simplified68.8%
associate-*r/61.5%
distribute-frac-neg261.5%
*-commutative61.5%
add-sqr-sqrt30.7%
sqrt-unprod30.9%
sqr-neg30.9%
sqrt-unprod0.3%
add-sqr-sqrt2.8%
associate-*l/2.9%
div-inv2.9%
associate-*l*4.8%
add-sqr-sqrt2.2%
sqrt-unprod36.6%
sqr-neg36.6%
sqrt-unprod34.3%
add-sqr-sqrt70.7%
*-commutative70.7%
div-inv70.8%
Applied egg-rr70.8%
if -2.3499999999999999e61 < y < 9.5e16Initial program 97.7%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in x around inf 56.2%
if 9.5e16 < y Initial program 88.3%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 39.2%
mul-1-neg39.2%
associate-/l*46.0%
distribute-rgt-neg-in46.0%
distribute-frac-neg246.0%
Simplified46.0%
associate-*r/39.2%
distribute-frac-neg239.2%
*-commutative39.2%
add-sqr-sqrt18.9%
sqrt-unprod24.1%
sqr-neg24.1%
sqrt-unprod7.5%
add-sqr-sqrt10.0%
associate-*l/10.0%
div-inv10.0%
associate-*l*11.8%
add-sqr-sqrt9.3%
sqrt-unprod24.2%
sqr-neg24.2%
sqrt-unprod25.4%
add-sqr-sqrt49.2%
*-commutative49.2%
div-inv49.2%
Applied egg-rr49.2%
distribute-lft-neg-in49.2%
clear-num49.2%
un-div-inv49.7%
Applied egg-rr49.7%
Final simplification57.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.05e+32) (not (<= t 4.4e+73))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.05e+32) || !(t <= 4.4e+73)) {
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 ((t <= (-3.05d+32)) .or. (.not. (t <= 4.4d+73))) 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 ((t <= -3.05e+32) || !(t <= 4.4e+73)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.05e+32) or not (t <= 4.4e+73): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.05e+32) || !(t <= 4.4e+73)) 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 ((t <= -3.05e+32) || ~((t <= 4.4e+73))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.05e+32], N[Not[LessEqual[t, 4.4e+73]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.05 \cdot 10^{+32} \lor \neg \left(t \leq 4.4 \cdot 10^{+73}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.05000000000000014e32 or 4.4e73 < t Initial program 91.4%
associate-/l*89.4%
Simplified89.4%
Taylor expanded in x around 0 76.0%
mul-1-neg76.0%
distribute-frac-neg276.0%
associate-*r/75.7%
Simplified75.7%
Taylor expanded in z around 0 62.9%
associate-/l*64.1%
Simplified64.1%
if -3.05000000000000014e32 < t < 4.4e73Initial program 94.3%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in x around inf 51.2%
Final simplification56.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.42e+23) (/ t (/ a y)) (if (<= t 4e+69) x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.42e+23) {
tmp = t / (a / y);
} else if (t <= 4e+69) {
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 (t <= (-1.42d+23)) then
tmp = t / (a / y)
else if (t <= 4d+69) 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 (t <= -1.42e+23) {
tmp = t / (a / y);
} else if (t <= 4e+69) {
tmp = x;
} else {
tmp = t * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.42e+23: tmp = t / (a / y) elif t <= 4e+69: tmp = x else: tmp = t * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.42e+23) tmp = Float64(t / Float64(a / y)); elseif (t <= 4e+69) 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 (t <= -1.42e+23) tmp = t / (a / y); elseif (t <= 4e+69) tmp = x; else tmp = t * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.42e+23], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e+69], x, N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.42 \cdot 10^{+23}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+69}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -1.42000000000000004e23Initial program 94.2%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in x around 0 78.8%
mul-1-neg78.8%
distribute-frac-neg278.8%
associate-*r/76.9%
Simplified76.9%
Taylor expanded in z around 0 62.3%
associate-/l*62.9%
Simplified62.9%
clear-num62.8%
un-div-inv62.9%
Applied egg-rr62.9%
if -1.42000000000000004e23 < t < 4.0000000000000003e69Initial program 94.3%
associate-/l*96.2%
Simplified96.2%
Taylor expanded in x around inf 51.2%
if 4.0000000000000003e69 < t Initial program 88.6%
associate-/l*88.4%
Simplified88.4%
Taylor expanded in x around 0 73.1%
mul-1-neg73.1%
distribute-frac-neg273.1%
associate-*r/74.6%
Simplified74.6%
Taylor expanded in z around 0 63.6%
associate-/l*65.3%
Simplified65.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 93.2%
associate-/l*93.6%
Simplified93.6%
Taylor expanded in x around inf 38.2%
(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 2024157
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(! :herbie-platform default (if (< y -430450648655599/4000000000000000000000000) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t)))))))
(- x (/ (* y (- z t)) a)))