
(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 (let* ((t_1 (* y (- z t)))) (if (<= t_1 -2e+267) (+ x (/ y (/ a (- z t)))) (+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2e+267) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / 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) :: t_1
real(8) :: tmp
t_1 = y * (z - t)
if (t_1 <= (-2d+267)) then
tmp = x + (y / (a / (z - t)))
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2e+267) {
tmp = x + (y / (a / (z - t)));
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -2e+267: tmp = x + (y / (a / (z - t))) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -2e+267) tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -2e+267) tmp = x + (y / (a / (z - t))); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+267], N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+267}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -1.9999999999999999e267Initial program 66.2%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 66.2%
associate-*l/99.8%
associate-/r/100.0%
Simplified100.0%
if -1.9999999999999999e267 < (*.f64 y (-.f64 z t)) Initial program 98.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.4e+97) (not (<= y 3.1e-152))) (+ x (* y (/ (- z t) a))) (+ x (* (- z t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.4e+97) || !(y <= 3.1e-152)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + ((z - 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 <= (-3.4d+97)) .or. (.not. (y <= 3.1d-152))) then
tmp = x + (y * ((z - t) / a))
else
tmp = x + ((z - 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 <= -3.4e+97) || !(y <= 3.1e-152)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + ((z - t) * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.4e+97) or not (y <= 3.1e-152): tmp = x + (y * ((z - t) / a)) else: tmp = x + ((z - t) * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.4e+97) || !(y <= 3.1e-152)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -3.4e+97) || ~((y <= 3.1e-152))) tmp = x + (y * ((z - t) / a)); else tmp = x + ((z - t) * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.4e+97], N[Not[LessEqual[y, 3.1e-152]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{+97} \lor \neg \left(y \leq 3.1 \cdot 10^{-152}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -3.4000000000000001e97 or 3.0999999999999998e-152 < y Initial program 90.0%
associate-/l*99.4%
Simplified99.4%
if -3.4000000000000001e97 < y < 3.0999999999999998e-152Initial program 99.1%
*-commutative99.1%
associate-/l*97.2%
Applied egg-rr97.2%
Final simplification98.3%
(FPCore (x y z t a) :precision binary64 (if (<= y -1e+96) (+ x (* y (/ (- z t) a))) (if (<= y 4e-100) (+ 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 <= -1e+96) {
tmp = x + (y * ((z - t) / a));
} else if (y <= 4e-100) {
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 <= (-1d+96)) then
tmp = x + (y * ((z - t) / a))
else if (y <= 4d-100) 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 <= -1e+96) {
tmp = x + (y * ((z - t) / a));
} else if (y <= 4e-100) {
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 <= -1e+96: tmp = x + (y * ((z - t) / a)) elif y <= 4e-100: 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 <= -1e+96) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); elseif (y <= 4e-100) tmp = Float64(x + Float64(Float64(z - t) * Float64(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 <= -1e+96) tmp = x + (y * ((z - t) / a)); elseif (y <= 4e-100) 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, -1e+96], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e-100], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $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 -1 \cdot 10^{+96}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{-100}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if y < -1.00000000000000005e96Initial program 80.9%
associate-/l*98.4%
Simplified98.4%
if -1.00000000000000005e96 < y < 4.0000000000000001e-100Initial program 99.1%
*-commutative99.1%
associate-/l*97.4%
Applied egg-rr97.4%
if 4.0000000000000001e-100 < y Initial program 93.6%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 93.6%
associate-*l/93.7%
associate-/r/99.9%
Simplified99.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -212000.0) (not (<= z 1.9e+54))) (+ x (* z (/ y a))) (- x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -212000.0) || !(z <= 1.9e+54)) {
tmp = x + (z * (y / 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 ((z <= (-212000.0d0)) .or. (.not. (z <= 1.9d+54))) then
tmp = x + (z * (y / 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 ((z <= -212000.0) || !(z <= 1.9e+54)) {
tmp = x + (z * (y / a));
} else {
tmp = x - ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -212000.0) or not (z <= 1.9e+54): tmp = x + (z * (y / a)) else: tmp = x - ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -212000.0) || !(z <= 1.9e+54)) tmp = Float64(x + Float64(z * Float64(y / 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 ((z <= -212000.0) || ~((z <= 1.9e+54))) tmp = x + (z * (y / a)); else tmp = x - ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -212000.0], N[Not[LessEqual[z, 1.9e+54]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -212000 \lor \neg \left(z \leq 1.9 \cdot 10^{+54}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -212000 or 1.9000000000000001e54 < z Initial program 91.1%
*-commutative91.1%
associate-/l*96.5%
Applied egg-rr96.5%
Taylor expanded in z around inf 86.5%
associate-*l/90.1%
*-commutative90.1%
Simplified90.1%
if -212000 < z < 1.9000000000000001e54Initial program 97.3%
associate-/l*95.1%
Simplified95.1%
Taylor expanded in z around 0 90.4%
mul-1-neg90.4%
unsub-neg90.4%
*-commutative90.4%
associate-/l*88.2%
Simplified88.2%
Taylor expanded in y around 0 90.4%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.3e+34) (not (<= z 8.2e+56))) (+ x (* z (/ y a))) (- x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+34) || !(z <= 8.2e+56)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.3d+34)) .or. (.not. (z <= 8.2d+56))) then
tmp = x + (z * (y / a))
else
tmp = x - (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.3e+34) || !(z <= 8.2e+56)) {
tmp = x + (z * (y / a));
} else {
tmp = x - (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.3e+34) or not (z <= 8.2e+56): tmp = x + (z * (y / a)) else: tmp = x - (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.3e+34) || !(z <= 8.2e+56)) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x - Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.3e+34) || ~((z <= 8.2e+56))) tmp = x + (z * (y / a)); else tmp = x - (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.3e+34], N[Not[LessEqual[z, 8.2e+56]], $MachinePrecision]], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+34} \lor \neg \left(z \leq 8.2 \cdot 10^{+56}\right):\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.29999999999999988e34 or 8.2000000000000007e56 < z Initial program 90.7%
*-commutative90.7%
associate-/l*97.3%
Applied egg-rr97.3%
Taylor expanded in z around inf 86.8%
associate-*l/90.6%
*-commutative90.6%
Simplified90.6%
if -3.29999999999999988e34 < z < 8.2000000000000007e56Initial program 97.4%
*-commutative97.4%
associate-/l*93.2%
Applied egg-rr93.2%
Taylor expanded in z around 0 90.0%
mul-1-neg90.0%
sub-neg90.0%
associate-/l*89.4%
Simplified89.4%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.8e+161) (not (<= t 1.16e+259))) (* t (/ y (- a))) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.8e+161) || !(t <= 1.16e+259)) {
tmp = 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 <= (-2.8d+161)) .or. (.not. (t <= 1.16d+259))) then
tmp = 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 <= -2.8e+161) || !(t <= 1.16e+259)) {
tmp = t * (y / -a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.8e+161) or not (t <= 1.16e+259): tmp = t * (y / -a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.8e+161) || !(t <= 1.16e+259)) tmp = Float64(t * Float64(y / Float64(-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 <= -2.8e+161) || ~((t <= 1.16e+259))) tmp = t * (y / -a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.8e+161], N[Not[LessEqual[t, 1.16e+259]], $MachinePrecision]], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+161} \lor \neg \left(t \leq 1.16 \cdot 10^{+259}\right):\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.80000000000000021e161 or 1.16e259 < t Initial program 90.5%
*-commutative90.5%
associate-/l*97.9%
Applied egg-rr97.9%
Taylor expanded in z around 0 73.5%
mul-1-neg73.5%
sub-neg73.5%
associate-/l*82.8%
Simplified82.8%
Taylor expanded in x around 0 61.6%
mul-1-neg61.6%
associate-*r/70.9%
*-commutative70.9%
distribute-lft-neg-in70.9%
distribute-frac-neg270.9%
Simplified70.9%
if -2.80000000000000021e161 < t < 1.16e259Initial program 95.5%
*-commutative95.5%
associate-/l*94.3%
Applied egg-rr94.3%
Taylor expanded in z around inf 75.3%
associate-*l/76.9%
*-commutative76.9%
Simplified76.9%
Final simplification76.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -17000.0) (not (<= y 1.3e+46))) (* t (/ y (- a))) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -17000.0) || !(y <= 1.3e+46)) {
tmp = t * (y / -a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-17000.0d0)) .or. (.not. (y <= 1.3d+46))) then
tmp = t * (y / -a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -17000.0) || !(y <= 1.3e+46)) {
tmp = t * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -17000.0) or not (y <= 1.3e+46): tmp = t * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -17000.0) || !(y <= 1.3e+46)) tmp = Float64(t * 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 <= -17000.0) || ~((y <= 1.3e+46))) tmp = t * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -17000.0], N[Not[LessEqual[y, 1.3e+46]], $MachinePrecision]], N[(t * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -17000 \lor \neg \left(y \leq 1.3 \cdot 10^{+46}\right):\\
\;\;\;\;t \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -17000 or 1.30000000000000007e46 < y Initial program 87.5%
*-commutative87.5%
associate-/l*91.9%
Applied egg-rr91.9%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
sub-neg58.2%
associate-/l*63.6%
Simplified63.6%
Taylor expanded in x around 0 43.6%
mul-1-neg43.6%
associate-*r/49.9%
*-commutative49.9%
distribute-lft-neg-in49.9%
distribute-frac-neg249.9%
Simplified49.9%
if -17000 < y < 1.30000000000000007e46Initial program 99.8%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in x around inf 57.3%
Final simplification54.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -16500.0) (not (<= y 3e+46))) (* y (/ t (- a))) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -16500.0) || !(y <= 3e+46)) {
tmp = y * (t / -a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((y <= (-16500.0d0)) .or. (.not. (y <= 3d+46))) then
tmp = y * (t / -a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -16500.0) || !(y <= 3e+46)) {
tmp = y * (t / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -16500.0) or not (y <= 3e+46): tmp = y * (t / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -16500.0) || !(y <= 3e+46)) tmp = Float64(y * Float64(t / Float64(-a))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -16500.0) || ~((y <= 3e+46))) tmp = y * (t / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -16500.0], N[Not[LessEqual[y, 3e+46]], $MachinePrecision]], N[(y * N[(t / (-a)), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -16500 \lor \neg \left(y \leq 3 \cdot 10^{+46}\right):\\
\;\;\;\;y \cdot \frac{t}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -16500 or 3.00000000000000023e46 < y Initial program 87.5%
*-commutative87.5%
associate-/l*91.9%
Applied egg-rr91.9%
Taylor expanded in z around 0 58.2%
mul-1-neg58.2%
sub-neg58.2%
associate-/l*63.6%
Simplified63.6%
Taylor expanded in x around 0 43.6%
mul-1-neg43.6%
associate-*l/48.4%
*-commutative48.4%
Simplified48.4%
if -16500 < y < 3.00000000000000023e46Initial program 99.8%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in x around inf 57.3%
Final simplification53.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -3.3e+176) (+ x (* z (/ y a))) (+ x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3.3e+176) {
tmp = x + (z * (y / a));
} else {
tmp = x + (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 (z <= (-3.3d+176)) then
tmp = x + (z * (y / a))
else
tmp = x + (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 (z <= -3.3e+176) {
tmp = x + (z * (y / a));
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3.3e+176: tmp = x + (z * (y / a)) else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3.3e+176) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3.3e+176) tmp = x + (z * (y / a)); else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3.3e+176], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.3 \cdot 10^{+176}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if z < -3.30000000000000025e176Initial program 88.8%
*-commutative88.8%
associate-/l*99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 84.9%
associate-*l/96.0%
*-commutative96.0%
Simplified96.0%
if -3.30000000000000025e176 < z Initial program 95.4%
associate-/l*94.4%
Simplified94.4%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.7%
associate-/l*92.3%
Simplified92.3%
Taylor expanded in x around inf 40.5%
(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 2024180
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))