
(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 (+ x (/ (* y (- z t)) a))))
(if (<= t_1 -5e+255)
(+ x (/ (- z t) (/ a y)))
(if (<= t_1 1e+276) t_1 (+ x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * (z - t)) / a);
double tmp;
if (t_1 <= -5e+255) {
tmp = x + ((z - t) / (a / y));
} else if (t_1 <= 1e+276) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + ((y * (z - t)) / a)
if (t_1 <= (-5d+255)) then
tmp = x + ((z - t) / (a / y))
else if (t_1 <= 1d+276) then
tmp = t_1
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 t_1 = x + ((y * (z - t)) / a);
double tmp;
if (t_1 <= -5e+255) {
tmp = x + ((z - t) / (a / y));
} else if (t_1 <= 1e+276) {
tmp = t_1;
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * (z - t)) / a) tmp = 0 if t_1 <= -5e+255: tmp = x + ((z - t) / (a / y)) elif t_1 <= 1e+276: tmp = t_1 else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * Float64(z - t)) / a)) tmp = 0.0 if (t_1 <= -5e+255) tmp = Float64(x + Float64(Float64(z - t) / Float64(a / y))); elseif (t_1 <= 1e+276) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * (z - t)) / a); tmp = 0.0; if (t_1 <= -5e+255) tmp = x + ((z - t) / (a / y)); elseif (t_1 <= 1e+276) tmp = t_1; else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+255], N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+276], t$95$1, N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+255}:\\
\;\;\;\;x + \frac{z - t}{\frac{a}{y}}\\
\mathbf{elif}\;t\_1 \leq 10^{+276}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < -5.0000000000000002e255Initial program 86.2%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in y around 0 86.2%
*-commutative86.2%
associate-*r/99.9%
Simplified99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
if -5.0000000000000002e255 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < 1.0000000000000001e276Initial program 99.8%
if 1.0000000000000001e276 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) Initial program 85.9%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z t)) a))))
(if (<= t_1 -5e+266)
(+ x (* (- z t) (/ y a)))
(if (<= t_1 1e+276) t_1 (+ x (/ y (/ a (- z t))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y * (z - t)) / a);
double tmp;
if (t_1 <= -5e+266) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 1e+276) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x + ((y * (z - t)) / a)
if (t_1 <= (-5d+266)) then
tmp = x + ((z - t) * (y / a))
else if (t_1 <= 1d+276) then
tmp = t_1
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 t_1 = x + ((y * (z - t)) / a);
double tmp;
if (t_1 <= -5e+266) {
tmp = x + ((z - t) * (y / a));
} else if (t_1 <= 1e+276) {
tmp = t_1;
} else {
tmp = x + (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y * (z - t)) / a) tmp = 0 if t_1 <= -5e+266: tmp = x + ((z - t) * (y / a)) elif t_1 <= 1e+276: tmp = t_1 else: tmp = x + (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y * Float64(z - t)) / a)) tmp = 0.0 if (t_1 <= -5e+266) tmp = Float64(x + Float64(Float64(z - t) * Float64(y / a))); elseif (t_1 <= 1e+276) tmp = t_1; else tmp = Float64(x + Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y * (z - t)) / a); tmp = 0.0; if (t_1 <= -5e+266) tmp = x + ((z - t) * (y / a)); elseif (t_1 <= 1e+276) tmp = t_1; else tmp = x + (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e+266], N[(x + N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+276], t$95$1, N[(x + N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+266}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;t\_1 \leq 10^{+276}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < -4.9999999999999999e266Initial program 84.8%
associate-/l*95.2%
Simplified95.2%
Taylor expanded in y around 0 84.8%
*-commutative84.8%
associate-*r/99.9%
Simplified99.9%
if -4.9999999999999999e266 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) < 1.0000000000000001e276Initial program 99.8%
if 1.0000000000000001e276 < (+.f64 x (/.f64 (*.f64 y (-.f64 z t)) a)) Initial program 85.9%
associate-/l*99.9%
Simplified99.9%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(if (or (<= t -4.3e+204)
(and (not (<= t -1.3e+131)) (or (<= t -2.8e+97) (not (<= t 6e+219)))))
(* y (/ (- t) a))
(+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.3e+204) || (!(t <= -1.3e+131) && ((t <= -2.8e+97) || !(t <= 6e+219)))) {
tmp = y * (-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 ((t <= (-4.3d+204)) .or. (.not. (t <= (-1.3d+131))) .and. (t <= (-2.8d+97)) .or. (.not. (t <= 6d+219))) then
tmp = y * (-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 ((t <= -4.3e+204) || (!(t <= -1.3e+131) && ((t <= -2.8e+97) || !(t <= 6e+219)))) {
tmp = y * (-t / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.3e+204) or (not (t <= -1.3e+131) and ((t <= -2.8e+97) or not (t <= 6e+219))): tmp = y * (-t / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.3e+204) || (!(t <= -1.3e+131) && ((t <= -2.8e+97) || !(t <= 6e+219)))) tmp = Float64(y * Float64(Float64(-t) / 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 <= -4.3e+204) || (~((t <= -1.3e+131)) && ((t <= -2.8e+97) || ~((t <= 6e+219))))) tmp = y * (-t / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.3e+204], And[N[Not[LessEqual[t, -1.3e+131]], $MachinePrecision], Or[LessEqual[t, -2.8e+97], N[Not[LessEqual[t, 6e+219]], $MachinePrecision]]]], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.3 \cdot 10^{+204} \lor \neg \left(t \leq -1.3 \cdot 10^{+131}\right) \land \left(t \leq -2.8 \cdot 10^{+97} \lor \neg \left(t \leq 6 \cdot 10^{+219}\right)\right):\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.3e204 or -1.3e131 < t < -2.7999999999999999e97 or 5.9999999999999995e219 < t Initial program 91.7%
associate-/l*91.8%
Simplified91.8%
Taylor expanded in z around 0 87.5%
mul-1-neg87.5%
unsub-neg87.5%
*-commutative87.5%
associate-/l*87.6%
Simplified87.6%
Taylor expanded in x around 0 69.6%
mul-1-neg69.6%
associate-*l/69.7%
distribute-lft-neg-in69.7%
*-commutative69.7%
distribute-frac-neg269.7%
Simplified69.7%
if -4.3e204 < t < -1.3e131 or -2.7999999999999999e97 < t < 5.9999999999999995e219Initial program 95.8%
associate-/l*95.4%
Simplified95.4%
Taylor expanded in y around 0 95.8%
*-commutative95.8%
associate-*r/96.0%
Simplified96.0%
Taylor expanded in z around inf 79.5%
associate-*l/81.9%
*-commutative81.9%
Simplified81.9%
Final simplification79.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- t) a))))
(if (<= t -1.35e+207)
t_1
(if (<= t -1.22e+134)
(+ x (/ z (/ a y)))
(if (or (<= t -3.5e+97) (not (<= t 3.8e+219)))
t_1
(+ x (* z (/ y a))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-t / a);
double tmp;
if (t <= -1.35e+207) {
tmp = t_1;
} else if (t <= -1.22e+134) {
tmp = x + (z / (a / y));
} else if ((t <= -3.5e+97) || !(t <= 3.8e+219)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * (-t / a)
if (t <= (-1.35d+207)) then
tmp = t_1
else if (t <= (-1.22d+134)) then
tmp = x + (z / (a / y))
else if ((t <= (-3.5d+97)) .or. (.not. (t <= 3.8d+219))) then
tmp = t_1
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 t_1 = y * (-t / a);
double tmp;
if (t <= -1.35e+207) {
tmp = t_1;
} else if (t <= -1.22e+134) {
tmp = x + (z / (a / y));
} else if ((t <= -3.5e+97) || !(t <= 3.8e+219)) {
tmp = t_1;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-t / a) tmp = 0 if t <= -1.35e+207: tmp = t_1 elif t <= -1.22e+134: tmp = x + (z / (a / y)) elif (t <= -3.5e+97) or not (t <= 3.8e+219): tmp = t_1 else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-t) / a)) tmp = 0.0 if (t <= -1.35e+207) tmp = t_1; elseif (t <= -1.22e+134) tmp = Float64(x + Float64(z / Float64(a / y))); elseif ((t <= -3.5e+97) || !(t <= 3.8e+219)) tmp = t_1; else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-t / a); tmp = 0.0; if (t <= -1.35e+207) tmp = t_1; elseif (t <= -1.22e+134) tmp = x + (z / (a / y)); elseif ((t <= -3.5e+97) || ~((t <= 3.8e+219))) tmp = t_1; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.35e+207], t$95$1, If[LessEqual[t, -1.22e+134], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -3.5e+97], N[Not[LessEqual[t, 3.8e+219]], $MachinePrecision]], t$95$1, N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-t}{a}\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{+207}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.22 \cdot 10^{+134}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;t \leq -3.5 \cdot 10^{+97} \lor \neg \left(t \leq 3.8 \cdot 10^{+219}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -1.35000000000000012e207 or -1.21999999999999992e134 < t < -3.5000000000000001e97 or 3.79999999999999996e219 < t Initial program 91.7%
associate-/l*91.8%
Simplified91.8%
Taylor expanded in z around 0 87.5%
mul-1-neg87.5%
unsub-neg87.5%
*-commutative87.5%
associate-/l*87.6%
Simplified87.6%
Taylor expanded in x around 0 69.6%
mul-1-neg69.6%
associate-*l/69.7%
distribute-lft-neg-in69.7%
*-commutative69.7%
distribute-frac-neg269.7%
Simplified69.7%
if -1.35000000000000012e207 < t < -1.21999999999999992e134Initial program 81.0%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in y around 0 81.0%
*-commutative81.0%
associate-*r/90.6%
Simplified90.6%
clear-num90.6%
un-div-inv90.7%
Applied egg-rr90.7%
Taylor expanded in z around inf 62.3%
*-commutative62.3%
associate-*l/71.7%
associate-/r/81.2%
Simplified81.2%
if -3.5000000000000001e97 < t < 3.79999999999999996e219Initial program 96.5%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in y around 0 96.5%
*-commutative96.5%
associate-*r/96.3%
Simplified96.3%
Taylor expanded in z around inf 80.4%
associate-*l/82.0%
*-commutative82.0%
Simplified82.0%
Final simplification79.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1e-70) (not (<= t 4.25e+43))) (- x (* t (/ y a))) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1e-70) || !(t <= 4.25e+43)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (y * (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 ((t <= (-1d-70)) .or. (.not. (t <= 4.25d+43))) then
tmp = x - (t * (y / a))
else
tmp = x + (y * (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 ((t <= -1e-70) || !(t <= 4.25e+43)) {
tmp = x - (t * (y / a));
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1e-70) or not (t <= 4.25e+43): tmp = x - (t * (y / a)) else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1e-70) || !(t <= 4.25e+43)) tmp = Float64(x - Float64(t * Float64(y / a))); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1e-70) || ~((t <= 4.25e+43))) tmp = x - (t * (y / a)); else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1e-70], N[Not[LessEqual[t, 4.25e+43]], $MachinePrecision]], N[(x - N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-70} \lor \neg \left(t \leq 4.25 \cdot 10^{+43}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -9.99999999999999996e-71 or 4.25e43 < t Initial program 93.8%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in y around 0 93.8%
*-commutative93.8%
associate-*r/97.3%
Simplified97.3%
Taylor expanded in z around 0 83.3%
metadata-eval83.3%
associate-*r/84.8%
cancel-sign-sub-inv84.8%
*-lft-identity84.8%
Simplified84.8%
if -9.99999999999999996e-71 < t < 4.25e43Initial program 96.3%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in t around 0 90.6%
+-commutative90.6%
associate-/l*92.6%
Simplified92.6%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e-70) (not (<= t 3.4e+45))) (- x (/ t (/ a y))) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e-70) || !(t <= 3.4e+45)) {
tmp = x - (t / (a / y));
} else {
tmp = x + (y * (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 ((t <= (-3.4d-70)) .or. (.not. (t <= 3.4d+45))) then
tmp = x - (t / (a / y))
else
tmp = x + (y * (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 ((t <= -3.4e-70) || !(t <= 3.4e+45)) {
tmp = x - (t / (a / y));
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.4e-70) or not (t <= 3.4e+45): tmp = x - (t / (a / y)) else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e-70) || !(t <= 3.4e+45)) tmp = Float64(x - Float64(t / Float64(a / y))); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.4e-70) || ~((t <= 3.4e+45))) tmp = x - (t / (a / y)); else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e-70], N[Not[LessEqual[t, 3.4e+45]], $MachinePrecision]], N[(x - N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{-70} \lor \neg \left(t \leq 3.4 \cdot 10^{+45}\right):\\
\;\;\;\;x - \frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -3.39999999999999995e-70 or 3.4e45 < t Initial program 93.8%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in y around 0 93.8%
*-commutative93.8%
associate-*r/97.3%
Simplified97.3%
clear-num97.3%
un-div-inv97.3%
Applied egg-rr97.3%
Taylor expanded in z around 0 83.3%
mul-1-neg83.3%
associate-*l/81.2%
sub-neg81.2%
associate-/r/84.9%
Simplified84.9%
if -3.39999999999999995e-70 < t < 3.4e45Initial program 96.3%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in t around 0 90.6%
+-commutative90.6%
associate-/l*92.6%
Simplified92.6%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e+56) (not (<= t 3.4e+41))) (* y (/ (- t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e+56) || !(t <= 3.4e+41)) {
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 ((t <= (-3.4d+56)) .or. (.not. (t <= 3.4d+41))) 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 ((t <= -3.4e+56) || !(t <= 3.4e+41)) {
tmp = y * (-t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.4e+56) or not (t <= 3.4e+41): tmp = y * (-t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e+56) || !(t <= 3.4e+41)) tmp = Float64(y * Float64(Float64(-t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.4e+56) || ~((t <= 3.4e+41))) tmp = y * (-t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e+56], N[Not[LessEqual[t, 3.4e+41]], $MachinePrecision]], N[(y * N[((-t) / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+56} \lor \neg \left(t \leq 3.4 \cdot 10^{+41}\right):\\
\;\;\;\;y \cdot \frac{-t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -3.40000000000000001e56 or 3.39999999999999998e41 < t Initial program 92.9%
associate-/l*89.2%
Simplified89.2%
Taylor expanded in z around 0 82.6%
mul-1-neg82.6%
unsub-neg82.6%
*-commutative82.6%
associate-/l*79.9%
Simplified79.9%
Taylor expanded in x around 0 57.7%
mul-1-neg57.7%
associate-*l/54.9%
distribute-lft-neg-in54.9%
*-commutative54.9%
distribute-frac-neg254.9%
Simplified54.9%
if -3.40000000000000001e56 < t < 3.39999999999999998e41Initial program 96.3%
associate-/l*98.0%
Simplified98.0%
Taylor expanded in x around inf 54.5%
Final simplification54.7%
(FPCore (x y z t a) :precision binary64 (if (<= z 1.32e+222) (+ x (* y (/ (- z t) a))) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= 1.32e+222) {
tmp = x + (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 (z <= 1.32d+222) then
tmp = x + (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 (z <= 1.32e+222) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= 1.32e+222: tmp = x + (y * ((z - t) / a)) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= 1.32e+222) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / 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 (z <= 1.32e+222) tmp = x + (y * ((z - t) / a)); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, 1.32e+222], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.32 \cdot 10^{+222}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < 1.31999999999999997e222Initial program 97.0%
associate-/l*96.3%
Simplified96.3%
if 1.31999999999999997e222 < z Initial program 74.2%
associate-/l*78.4%
Simplified78.4%
Taylor expanded in y around 0 74.2%
*-commutative74.2%
associate-*r/98.0%
Simplified98.0%
Taylor expanded in z around inf 74.2%
associate-*l/98.0%
*-commutative98.0%
Simplified98.0%
Final simplification96.4%
(FPCore (x y z t a) :precision binary64 (if (<= y -1e-188) (+ 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 <= -1e-188) {
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 <= (-1d-188)) 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 <= -1e-188) {
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 <= -1e-188: 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 <= -1e-188) 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 <= -1e-188) 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[LessEqual[y, -1e-188], 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 -1 \cdot 10^{-188}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \left(z - t\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if y < -9.9999999999999995e-189Initial program 92.8%
associate-/l*99.1%
Simplified99.1%
if -9.9999999999999995e-189 < y Initial program 96.7%
associate-/l*91.6%
Simplified91.6%
Taylor expanded in y around 0 96.7%
*-commutative96.7%
associate-*r/97.3%
Simplified97.3%
Final simplification98.0%
(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 95.0%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in x around inf 44.4%
Final simplification44.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(+ x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(+ x (/ (* y (- z t)) a))
(+ x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x + (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) / a)
else
tmp = x + (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x + (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) / a);
} else {
tmp = x + (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x + (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) / a) else: tmp = x + (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x + Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x + Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x + (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) / a); else tmp = x + (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x + N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x + \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024053
(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)))