
(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 12 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 (/ (- t z) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
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 + ((t - z) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((t - z) / (a / y));
}
def code(x, y, z, t, a): return x + ((t - z) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(t - z) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((t - z) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{t - z}{\frac{a}{y}}
\end{array}
Initial program 93.1%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in y around 0 93.1%
associate-*l/97.1%
*-commutative97.1%
Simplified97.1%
clear-num97.0%
un-div-inv97.1%
Applied egg-rr97.1%
Final simplification97.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* t (/ y a)))))
(if (<= t -2000.0)
t_1
(if (<= t -2.7e-50)
(* y (/ (- t z) a))
(if (<= t 1e-70) (- x (* y (/ z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * (y / a));
double tmp;
if (t <= -2000.0) {
tmp = t_1;
} else if (t <= -2.7e-50) {
tmp = y * ((t - z) / a);
} else if (t <= 1e-70) {
tmp = x - (y * (z / a));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (t * (y / a))
if (t <= (-2000.0d0)) then
tmp = t_1
else if (t <= (-2.7d-50)) then
tmp = y * ((t - z) / a)
else if (t <= 1d-70) then
tmp = x - (y * (z / a))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (t * (y / a));
double tmp;
if (t <= -2000.0) {
tmp = t_1;
} else if (t <= -2.7e-50) {
tmp = y * ((t - z) / a);
} else if (t <= 1e-70) {
tmp = x - (y * (z / a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (t * (y / a)) tmp = 0 if t <= -2000.0: tmp = t_1 elif t <= -2.7e-50: tmp = y * ((t - z) / a) elif t <= 1e-70: tmp = x - (y * (z / a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(t * Float64(y / a))) tmp = 0.0 if (t <= -2000.0) tmp = t_1; elseif (t <= -2.7e-50) tmp = Float64(y * Float64(Float64(t - z) / a)); elseif (t <= 1e-70) tmp = Float64(x - Float64(y * Float64(z / a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (t * (y / a)); tmp = 0.0; if (t <= -2000.0) tmp = t_1; elseif (t <= -2.7e-50) tmp = y * ((t - z) / a); elseif (t <= 1e-70) tmp = x - (y * (z / a)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2000.0], t$95$1, If[LessEqual[t, -2.7e-50], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-70], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + t \cdot \frac{y}{a}\\
\mathbf{if}\;t \leq -2000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -2.7 \cdot 10^{-50}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;t \leq 10^{-70}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2e3 or 9.99999999999999996e-71 < t Initial program 92.0%
associate-/l*92.7%
Simplified92.7%
Taylor expanded in y around 0 92.0%
associate-*l/97.7%
*-commutative97.7%
Simplified97.7%
Taylor expanded in z around 0 81.3%
mul-1-neg81.3%
associate-/l*85.8%
distribute-lft-neg-out85.8%
*-commutative85.8%
Simplified85.8%
*-commutative85.8%
cancel-sign-sub85.8%
associate-*r/81.3%
+-commutative81.3%
associate-*r/85.8%
Applied egg-rr85.8%
if -2e3 < t < -2.7e-50Initial program 100.0%
associate-/l*97.0%
Simplified97.0%
Taylor expanded in x around 0 96.9%
associate-*r/96.9%
neg-mul-196.9%
distribute-rgt-neg-in96.9%
sub-neg96.9%
distribute-neg-in96.9%
remove-double-neg96.9%
+-commutative96.9%
sub-neg96.9%
associate-*r/96.3%
Simplified96.3%
if -2.7e-50 < t < 9.99999999999999996e-71Initial program 94.1%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in z around inf 89.3%
associate-/l*88.2%
Simplified88.2%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.8e-206) (not (<= y 9e-235))) (+ x (* 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.8e-206) || !(y <= 9e-235)) {
tmp = x + (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.8d-206)) .or. (.not. (y <= 9d-235))) then
tmp = x + (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.8e-206) || !(y <= 9e-235)) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((t * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.8e-206) or not (y <= 9e-235): tmp = x + (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.8e-206) || !(y <= 9e-235)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.8e-206) || ~((y <= 9e-235))) tmp = x + (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.8e-206], N[Not[LessEqual[y, 9e-235]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.8 \cdot 10^{-206} \lor \neg \left(y \leq 9 \cdot 10^{-235}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if y < -1.79999999999999997e-206 or 8.9999999999999996e-235 < y Initial program 92.1%
associate-/l*97.5%
Simplified97.5%
if -1.79999999999999997e-206 < y < 8.9999999999999996e-235Initial program 99.8%
sub-neg99.8%
distribute-frac-neg299.8%
+-commutative99.8%
associate-/l*63.4%
fma-define63.4%
distribute-frac-neg263.4%
distribute-neg-frac63.4%
sub-neg63.4%
distribute-neg-in63.4%
remove-double-neg63.4%
+-commutative63.4%
sub-neg63.4%
Simplified63.4%
Taylor expanded in z around 0 91.2%
Final simplification96.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -6.8e-49) (not (<= z 1.8e+105))) (- x (* z (/ y a))) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -6.8e-49) || !(z <= 1.8e+105)) {
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 <= (-6.8d-49)) .or. (.not. (z <= 1.8d+105))) 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 <= -6.8e-49) || !(z <= 1.8e+105)) {
tmp = x - (z * (y / a));
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -6.8e-49) or not (z <= 1.8e+105): 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 <= -6.8e-49) || !(z <= 1.8e+105)) 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 <= -6.8e-49) || ~((z <= 1.8e+105))) 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, -6.8e-49], N[Not[LessEqual[z, 1.8e+105]], $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 -6.8 \cdot 10^{-49} \lor \neg \left(z \leq 1.8 \cdot 10^{+105}\right):\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -6.8000000000000001e-49 or 1.7999999999999999e105 < z Initial program 91.2%
associate-/l*92.0%
Simplified92.0%
Taylor expanded in y around 0 91.2%
associate-*l/98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in z around inf 81.5%
*-commutative81.5%
associate-*r/86.0%
Simplified86.0%
if -6.8000000000000001e-49 < z < 1.7999999999999999e105Initial program 94.5%
associate-/l*93.7%
Simplified93.7%
Taylor expanded in y around 0 94.5%
associate-*l/96.0%
*-commutative96.0%
Simplified96.0%
Taylor expanded in z around 0 85.1%
mul-1-neg85.1%
associate-/l*88.3%
distribute-lft-neg-out88.3%
*-commutative88.3%
Simplified88.3%
*-commutative88.3%
cancel-sign-sub88.3%
associate-*r/85.1%
+-commutative85.1%
associate-*r/88.3%
Applied egg-rr88.3%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.6e-155) (not (<= x 2e+30))) (+ x (* t (/ y a))) (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.6e-155) || !(x <= 2e+30)) {
tmp = x + (t * (y / a));
} 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) :: tmp
if ((x <= (-1.6d-155)) .or. (.not. (x <= 2d+30))) then
tmp = x + (t * (y / a))
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 tmp;
if ((x <= -1.6e-155) || !(x <= 2e+30)) {
tmp = x + (t * (y / a));
} else {
tmp = (y / a) * (t - z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.6e-155) or not (x <= 2e+30): tmp = x + (t * (y / a)) else: tmp = (y / a) * (t - z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.6e-155) || !(x <= 2e+30)) tmp = Float64(x + Float64(t * Float64(y / a))); else tmp = Float64(Float64(y / a) * Float64(t - z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.6e-155) || ~((x <= 2e+30))) tmp = x + (t * (y / a)); else tmp = (y / a) * (t - z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.6e-155], N[Not[LessEqual[x, 2e+30]], $MachinePrecision]], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.6 \cdot 10^{-155} \lor \neg \left(x \leq 2 \cdot 10^{+30}\right):\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if x < -1.60000000000000006e-155 or 2e30 < x Initial program 93.2%
associate-/l*93.1%
Simplified93.1%
Taylor expanded in y around 0 93.2%
associate-*l/98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in z around 0 80.4%
mul-1-neg80.4%
associate-/l*85.2%
distribute-lft-neg-out85.2%
*-commutative85.2%
Simplified85.2%
*-commutative85.2%
cancel-sign-sub85.2%
associate-*r/80.4%
+-commutative80.4%
associate-*r/85.2%
Applied egg-rr85.2%
if -1.60000000000000006e-155 < x < 2e30Initial program 92.9%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in y around 0 92.9%
associate-*l/95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in x around 0 78.9%
mul-1-neg78.9%
*-commutative78.9%
associate-*r/81.5%
*-commutative81.5%
sub-neg81.5%
+-commutative81.5%
distribute-rgt-out75.1%
distribute-lft-neg-out75.1%
associate-/l*73.6%
mul-1-neg73.6%
distribute-neg-in73.6%
mul-1-neg73.6%
remove-double-neg73.6%
sub-neg73.6%
associate-/l*75.1%
distribute-rgt-out--81.5%
Simplified81.5%
Final simplification83.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.7e+16) (not (<= y 5.2e+156))) (* 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.7e+16) || !(y <= 5.2e+156)) {
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.7d+16)) .or. (.not. (y <= 5.2d+156))) 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.7e+16) || !(y <= 5.2e+156)) {
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.7e+16) or not (y <= 5.2e+156): 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.7e+16) || !(y <= 5.2e+156)) tmp = Float64(y * Float64(Float64(t - z) / a)); else tmp = Float64(x + Float64(Float64(t * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.7e+16) || ~((y <= 5.2e+156))) 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.7e+16], N[Not[LessEqual[y, 5.2e+156]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{+16} \lor \neg \left(y \leq 5.2 \cdot 10^{+156}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t \cdot y}{a}\\
\end{array}
\end{array}
if y < -1.7e16 or 5.20000000000000037e156 < y Initial program 84.1%
associate-/l*98.6%
Simplified98.6%
Taylor expanded in x around 0 75.1%
associate-*r/75.1%
neg-mul-175.1%
distribute-rgt-neg-in75.1%
sub-neg75.1%
distribute-neg-in75.1%
remove-double-neg75.1%
+-commutative75.1%
sub-neg75.1%
associate-*r/85.6%
Simplified85.6%
if -1.7e16 < y < 5.20000000000000037e156Initial program 99.1%
sub-neg99.1%
distribute-frac-neg299.1%
+-commutative99.1%
associate-/l*89.2%
fma-define89.2%
distribute-frac-neg289.2%
distribute-neg-frac89.2%
sub-neg89.2%
distribute-neg-in89.2%
remove-double-neg89.2%
+-commutative89.2%
sub-neg89.2%
Simplified89.2%
Taylor expanded in z around 0 79.9%
Final simplification82.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -3.9e-43) (not (<= y 1.45e-152))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -3.9e-43) || !(y <= 1.45e-152)) {
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 <= (-3.9d-43)) .or. (.not. (y <= 1.45d-152))) 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 <= -3.9e-43) || !(y <= 1.45e-152)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -3.9e-43) or not (y <= 1.45e-152): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -3.9e-43) || !(y <= 1.45e-152)) 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 <= -3.9e-43) || ~((y <= 1.45e-152))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -3.9e-43], N[Not[LessEqual[y, 1.45e-152]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.9 \cdot 10^{-43} \lor \neg \left(y \leq 1.45 \cdot 10^{-152}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -3.9e-43 or 1.4500000000000001e-152 < y Initial program 90.2%
associate-/l*98.1%
Simplified98.1%
Taylor expanded in x around 0 70.4%
associate-*r/70.4%
neg-mul-170.4%
distribute-rgt-neg-in70.4%
sub-neg70.4%
distribute-neg-in70.4%
remove-double-neg70.4%
+-commutative70.4%
sub-neg70.4%
associate-*r/76.5%
Simplified76.5%
if -3.9e-43 < y < 1.4500000000000001e-152Initial program 99.8%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in x around inf 59.7%
Final simplification71.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -8.6e+38) x (if (<= a 2.35e+215) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8.6e+38) {
tmp = x;
} else if (a <= 2.35e+215) {
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 <= (-8.6d+38)) then
tmp = x
else if (a <= 2.35d+215) 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 <= -8.6e+38) {
tmp = x;
} else if (a <= 2.35e+215) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8.6e+38: tmp = x elif a <= 2.35e+215: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8.6e+38) tmp = x; elseif (a <= 2.35e+215) 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 <= -8.6e+38) tmp = x; elseif (a <= 2.35e+215) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8.6e+38], x, If[LessEqual[a, 2.35e+215], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.6 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.35 \cdot 10^{+215}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -8.5999999999999994e38 or 2.3500000000000001e215 < a Initial program 81.2%
associate-/l*98.3%
Simplified98.3%
Taylor expanded in x around inf 62.9%
if -8.5999999999999994e38 < a < 2.3500000000000001e215Initial program 98.7%
associate-/l*90.5%
Simplified90.5%
Taylor expanded in y around 0 98.7%
associate-*l/96.6%
*-commutative96.6%
Simplified96.6%
Taylor expanded in x around 0 79.3%
mul-1-neg79.3%
*-commutative79.3%
associate-*r/77.2%
*-commutative77.2%
sub-neg77.2%
+-commutative77.2%
distribute-rgt-out66.7%
distribute-lft-neg-out66.7%
associate-/l*67.4%
mul-1-neg67.4%
distribute-neg-in67.4%
mul-1-neg67.4%
remove-double-neg67.4%
sub-neg67.4%
associate-/l*66.7%
distribute-rgt-out--77.2%
Simplified77.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -22000.0) x (if (<= a 1.4e+80) (/ t (/ a y)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -22000.0) {
tmp = x;
} else if (a <= 1.4e+80) {
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 (a <= (-22000.0d0)) then
tmp = x
else if (a <= 1.4d+80) 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 (a <= -22000.0) {
tmp = x;
} else if (a <= 1.4e+80) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -22000.0: tmp = x elif a <= 1.4e+80: tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -22000.0) tmp = x; elseif (a <= 1.4e+80) 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 (a <= -22000.0) tmp = x; elseif (a <= 1.4e+80) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -22000.0], x, If[LessEqual[a, 1.4e+80], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -22000:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.4 \cdot 10^{+80}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -22000 or 1.39999999999999992e80 < a Initial program 84.5%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in x around inf 56.6%
if -22000 < a < 1.39999999999999992e80Initial program 99.8%
associate-/l*88.6%
Simplified88.6%
Taylor expanded in t around inf 58.1%
associate-/l*58.7%
Simplified58.7%
clear-num58.7%
div-inv58.8%
Applied egg-rr58.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -16000.0) x (if (<= a 3.8e+80) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -16000.0) {
tmp = x;
} else if (a <= 3.8e+80) {
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 (a <= (-16000.0d0)) then
tmp = x
else if (a <= 3.8d+80) 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 (a <= -16000.0) {
tmp = x;
} else if (a <= 3.8e+80) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -16000.0: tmp = x elif a <= 3.8e+80: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -16000.0) tmp = x; elseif (a <= 3.8e+80) 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 (a <= -16000.0) tmp = x; elseif (a <= 3.8e+80) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -16000.0], x, If[LessEqual[a, 3.8e+80], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -16000:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{+80}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -16000 or 3.79999999999999997e80 < a Initial program 84.5%
associate-/l*98.7%
Simplified98.7%
Taylor expanded in x around inf 56.6%
if -16000 < a < 3.79999999999999997e80Initial program 99.8%
associate-/l*88.6%
Simplified88.6%
Taylor expanded in t around inf 58.1%
associate-/l*58.7%
Simplified58.7%
(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 93.1%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in y around 0 93.1%
associate-*l/97.1%
*-commutative97.1%
Simplified97.1%
Final simplification97.1%
(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.1%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in x around inf 34.1%
(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 2024172
(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)))