
(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 (if (<= a -5.9e-108) (+ x (* y (/ (- t z) a))) (+ x (/ (- t z) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -5.9e-108) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((t - 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 (a <= (-5.9d-108)) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((t - 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 (a <= -5.9e-108) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((t - z) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -5.9e-108: tmp = x + (y * ((t - z) / a)) else: tmp = x + ((t - z) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -5.9e-108) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(t - z) / Float64(a / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -5.9e-108) tmp = x + (y * ((t - z) / a)); else tmp = x + ((t - z) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -5.9e-108], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.9 \cdot 10^{-108}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\end{array}
\end{array}
if a < -5.89999999999999965e-108Initial program 94.8%
associate-/l*99.9%
Simplified99.9%
if -5.89999999999999965e-108 < a Initial program 92.5%
associate-/l*89.5%
Simplified89.5%
associate-*r/92.5%
*-commutative92.5%
associate-*r/99.2%
clear-num99.2%
un-div-inv99.3%
Applied egg-rr99.3%
Final simplification99.5%
(FPCore (x y z t a)
:precision binary64
(if (<= x -8.5e-52)
x
(if (<= x 2.9e-114)
(/ t (/ a y))
(if (<= x 3.4e-53)
(* y (/ z (- a)))
(if (<= x 0.00065) (* y (/ t a)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.5e-52) {
tmp = x;
} else if (x <= 2.9e-114) {
tmp = t / (a / y);
} else if (x <= 3.4e-53) {
tmp = y * (z / -a);
} else if (x <= 0.00065) {
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 (x <= (-8.5d-52)) then
tmp = x
else if (x <= 2.9d-114) then
tmp = t / (a / y)
else if (x <= 3.4d-53) then
tmp = y * (z / -a)
else if (x <= 0.00065d0) 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 (x <= -8.5e-52) {
tmp = x;
} else if (x <= 2.9e-114) {
tmp = t / (a / y);
} else if (x <= 3.4e-53) {
tmp = y * (z / -a);
} else if (x <= 0.00065) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.5e-52: tmp = x elif x <= 2.9e-114: tmp = t / (a / y) elif x <= 3.4e-53: tmp = y * (z / -a) elif x <= 0.00065: tmp = y * (t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.5e-52) tmp = x; elseif (x <= 2.9e-114) tmp = Float64(t / Float64(a / y)); elseif (x <= 3.4e-53) tmp = Float64(y * Float64(z / Float64(-a))); elseif (x <= 0.00065) tmp = Float64(y * Float64(t / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8.5e-52) tmp = x; elseif (x <= 2.9e-114) tmp = t / (a / y); elseif (x <= 3.4e-53) tmp = y * (z / -a); elseif (x <= 0.00065) tmp = y * (t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.5e-52], x, If[LessEqual[x, 2.9e-114], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.4e-53], N[(y * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.00065], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.5 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{-53}:\\
\;\;\;\;y \cdot \frac{z}{-a}\\
\mathbf{elif}\;x \leq 0.00065:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.50000000000000006e-52 or 6.4999999999999997e-4 < x Initial program 94.4%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in x around inf 62.7%
if -8.50000000000000006e-52 < x < 2.89999999999999997e-114Initial program 92.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around inf 50.6%
associate-/l*55.3%
Simplified55.3%
clear-num55.3%
un-div-inv55.6%
Applied egg-rr55.6%
if 2.89999999999999997e-114 < x < 3.4e-53Initial program 86.0%
associate-/l*85.3%
Simplified85.3%
Taylor expanded in z around inf 49.3%
mul-1-neg49.3%
associate-/l*48.6%
distribute-rgt-neg-in48.6%
distribute-neg-frac248.6%
Simplified48.6%
if 3.4e-53 < x < 6.4999999999999997e-4Initial program 93.4%
associate-/l*87.4%
Simplified87.4%
Taylor expanded in t around inf 35.5%
associate-/l*41.1%
Simplified41.1%
Taylor expanded in t around 0 35.5%
*-commutative35.5%
associate-*r/41.1%
Simplified41.1%
Final simplification58.2%
(FPCore (x y z t a) :precision binary64 (if (<= x -4.5e-52) x (if (<= x 1.45e-114) (/ t (/ a y)) (if (<= x 2250.0) (* z (/ y (- a))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4.5e-52) {
tmp = x;
} else if (x <= 1.45e-114) {
tmp = t / (a / y);
} else if (x <= 2250.0) {
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 (x <= (-4.5d-52)) then
tmp = x
else if (x <= 1.45d-114) then
tmp = t / (a / y)
else if (x <= 2250.0d0) 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 (x <= -4.5e-52) {
tmp = x;
} else if (x <= 1.45e-114) {
tmp = t / (a / y);
} else if (x <= 2250.0) {
tmp = z * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -4.5e-52: tmp = x elif x <= 1.45e-114: tmp = t / (a / y) elif x <= 2250.0: tmp = z * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4.5e-52) tmp = x; elseif (x <= 1.45e-114) tmp = Float64(t / Float64(a / y)); elseif (x <= 2250.0) 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 (x <= -4.5e-52) tmp = x; elseif (x <= 1.45e-114) tmp = t / (a / y); elseif (x <= 2250.0) tmp = z * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4.5e-52], x, If[LessEqual[x, 1.45e-114], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2250.0], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 2250:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.5e-52 or 2250 < x Initial program 95.0%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in x around inf 63.2%
if -4.5e-52 < x < 1.44999999999999998e-114Initial program 92.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around inf 50.6%
associate-/l*55.3%
Simplified55.3%
clear-num55.3%
un-div-inv55.6%
Applied egg-rr55.6%
if 1.44999999999999998e-114 < x < 2250Initial program 87.1%
associate-/l*86.8%
Simplified86.8%
associate-*r/87.1%
*-commutative87.1%
associate-*r/96.8%
clear-num96.7%
un-div-inv96.8%
Applied egg-rr96.8%
Taylor expanded in z around inf 40.3%
mul-1-neg40.3%
associate-*r/36.7%
*-commutative36.7%
associate-*l/40.3%
associate-*r/52.8%
distribute-rgt-neg-in52.8%
Simplified52.8%
Final simplification59.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -8.2e-52) x (if (<= x 3.8e-114) (/ t (/ a y)) (if (<= x 400.0) (/ z (/ (- a) y)) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8.2e-52) {
tmp = x;
} else if (x <= 3.8e-114) {
tmp = t / (a / y);
} else if (x <= 400.0) {
tmp = z / (-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 (x <= (-8.2d-52)) then
tmp = x
else if (x <= 3.8d-114) then
tmp = t / (a / y)
else if (x <= 400.0d0) then
tmp = z / (-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 (x <= -8.2e-52) {
tmp = x;
} else if (x <= 3.8e-114) {
tmp = t / (a / y);
} else if (x <= 400.0) {
tmp = z / (-a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8.2e-52: tmp = x elif x <= 3.8e-114: tmp = t / (a / y) elif x <= 400.0: tmp = z / (-a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8.2e-52) tmp = x; elseif (x <= 3.8e-114) tmp = Float64(t / Float64(a / y)); elseif (x <= 400.0) tmp = Float64(z / Float64(Float64(-a) / y)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -8.2e-52) tmp = x; elseif (x <= 3.8e-114) tmp = t / (a / y); elseif (x <= 400.0) tmp = z / (-a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8.2e-52], x, If[LessEqual[x, 3.8e-114], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 400.0], N[(z / N[((-a) / y), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-52}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{elif}\;x \leq 400:\\
\;\;\;\;\frac{z}{\frac{-a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -8.19999999999999977e-52 or 400 < x Initial program 95.0%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in x around inf 63.2%
if -8.19999999999999977e-52 < x < 3.7999999999999998e-114Initial program 92.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around inf 50.6%
associate-/l*55.3%
Simplified55.3%
clear-num55.3%
un-div-inv55.6%
Applied egg-rr55.6%
if 3.7999999999999998e-114 < x < 400Initial program 87.1%
associate-/l*86.8%
Simplified86.8%
Taylor expanded in z around inf 40.3%
mul-1-neg40.3%
associate-/l*36.7%
distribute-rgt-neg-in36.7%
distribute-neg-frac236.7%
Simplified36.7%
associate-*r/40.3%
add-sqr-sqrt28.2%
sqrt-unprod22.7%
sqr-neg22.7%
sqrt-unprod1.2%
add-sqr-sqrt2.1%
associate-/l*2.3%
*-commutative2.3%
associate-/r/5.6%
frac-2neg5.6%
distribute-neg-frac5.6%
add-sqr-sqrt4.4%
sqrt-unprod19.0%
sqr-neg19.0%
sqrt-unprod21.4%
add-sqr-sqrt52.9%
Applied egg-rr52.9%
Final simplification59.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -7.6e-82) (not (<= y 6.8e-152))) (* y (/ (- t z) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -7.6e-82) || !(y <= 6.8e-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 <= (-7.6d-82)) .or. (.not. (y <= 6.8d-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 <= -7.6e-82) || !(y <= 6.8e-152)) {
tmp = y * ((t - z) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -7.6e-82) or not (y <= 6.8e-152): tmp = y * ((t - z) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -7.6e-82) || !(y <= 6.8e-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 <= -7.6e-82) || ~((y <= 6.8e-152))) tmp = y * ((t - z) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -7.6e-82], N[Not[LessEqual[y, 6.8e-152]], $MachinePrecision]], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -7.6 \cdot 10^{-82} \lor \neg \left(y \leq 6.8 \cdot 10^{-152}\right):\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -7.60000000000000041e-82 or 6.79999999999999968e-152 < y Initial program 91.0%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in x around 0 67.1%
mul-1-neg67.1%
associate-*r/71.7%
distribute-rgt-neg-in71.7%
neg-sub071.7%
div-sub69.4%
associate-+l-69.4%
neg-sub069.4%
+-commutative69.4%
sub-neg69.4%
div-sub71.7%
*-lft-identity71.7%
*-lft-identity71.7%
Simplified71.7%
if -7.60000000000000041e-82 < y < 6.79999999999999968e-152Initial program 98.6%
associate-/l*84.1%
Simplified84.1%
Taylor expanded in x around inf 71.9%
Final simplification71.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.42e+51) (not (<= z 3.6e+67))) (- x (/ (* y z) a)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.42e+51) || !(z <= 3.6e+67)) {
tmp = x - ((y * 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 ((z <= (-1.42d+51)) .or. (.not. (z <= 3.6d+67))) then
tmp = x - ((y * 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 ((z <= -1.42e+51) || !(z <= 3.6e+67)) {
tmp = x - ((y * z) / a);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.42e+51) or not (z <= 3.6e+67): tmp = x - ((y * z) / a) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.42e+51) || !(z <= 3.6e+67)) tmp = Float64(x - Float64(Float64(y * 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 ((z <= -1.42e+51) || ~((z <= 3.6e+67))) tmp = x - ((y * z) / a); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.42e+51], N[Not[LessEqual[z, 3.6e+67]], $MachinePrecision]], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.42 \cdot 10^{+51} \lor \neg \left(z \leq 3.6 \cdot 10^{+67}\right):\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -1.41999999999999998e51 or 3.5999999999999999e67 < z Initial program 88.2%
associate-/l*90.0%
Simplified90.0%
Taylor expanded in z around inf 85.7%
if -1.41999999999999998e51 < z < 3.5999999999999999e67Initial program 96.4%
sub-neg96.4%
distribute-frac-neg296.4%
+-commutative96.4%
associate-/l*95.2%
fma-define95.2%
distribute-frac-neg295.2%
distribute-neg-frac95.2%
sub-neg95.2%
distribute-neg-in95.2%
remove-double-neg95.2%
+-commutative95.2%
sub-neg95.2%
Simplified95.2%
Taylor expanded in z around 0 89.5%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -4.8e+56) (* z (/ y (- a))) (if (<= z 9e+31) (+ x (/ (* y t) a)) (* y (/ (- t z) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.8e+56) {
tmp = z * (y / -a);
} else if (z <= 9e+31) {
tmp = x + ((y * t) / a);
} else {
tmp = 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 (z <= (-4.8d+56)) then
tmp = z * (y / -a)
else if (z <= 9d+31) then
tmp = x + ((y * t) / a)
else
tmp = 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 (z <= -4.8e+56) {
tmp = z * (y / -a);
} else if (z <= 9e+31) {
tmp = x + ((y * t) / a);
} else {
tmp = y * ((t - z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.8e+56: tmp = z * (y / -a) elif z <= 9e+31: tmp = x + ((y * t) / a) else: tmp = y * ((t - z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.8e+56) tmp = Float64(z * Float64(y / Float64(-a))); elseif (z <= 9e+31) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(y * Float64(Float64(t - z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.8e+56) tmp = z * (y / -a); elseif (z <= 9e+31) tmp = x + ((y * t) / a); else tmp = y * ((t - z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.8e+56], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9e+31], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+56}:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{+31}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{t - z}{a}\\
\end{array}
\end{array}
if z < -4.80000000000000027e56Initial program 80.5%
associate-/l*87.9%
Simplified87.9%
associate-*r/80.5%
*-commutative80.5%
associate-*r/98.3%
clear-num97.7%
un-div-inv97.9%
Applied egg-rr97.9%
Taylor expanded in z around inf 51.3%
mul-1-neg51.3%
associate-*r/56.7%
*-commutative56.7%
associate-*l/51.3%
associate-*r/64.0%
distribute-rgt-neg-in64.0%
Simplified64.0%
if -4.80000000000000027e56 < z < 8.9999999999999992e31Initial program 96.8%
sub-neg96.8%
distribute-frac-neg296.8%
+-commutative96.8%
associate-/l*94.9%
fma-define94.8%
distribute-frac-neg294.8%
distribute-neg-frac94.8%
sub-neg94.8%
distribute-neg-in94.8%
remove-double-neg94.8%
+-commutative94.8%
sub-neg94.8%
Simplified94.8%
Taylor expanded in z around 0 91.6%
if 8.9999999999999992e31 < z Initial program 95.1%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in x around 0 73.6%
mul-1-neg73.6%
associate-*r/73.7%
distribute-rgt-neg-in73.7%
neg-sub073.7%
div-sub68.6%
associate-+l-68.6%
neg-sub068.6%
+-commutative68.6%
sub-neg68.6%
div-sub73.7%
*-lft-identity73.7%
*-lft-identity73.7%
Simplified73.7%
Final simplification82.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.4e-54) x (if (<= x 2.1e-114) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.4e-54) {
tmp = x;
} else if (x <= 2.1e-114) {
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 (x <= (-2.4d-54)) then
tmp = x
else if (x <= 2.1d-114) 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 (x <= -2.4e-54) {
tmp = x;
} else if (x <= 2.1e-114) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.4e-54: tmp = x elif x <= 2.1e-114: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.4e-54) tmp = x; elseif (x <= 2.1e-114) 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 (x <= -2.4e-54) tmp = x; elseif (x <= 2.1e-114) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.4e-54], x, If[LessEqual[x, 2.1e-114], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-54}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.1 \cdot 10^{-114}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -2.40000000000000013e-54 or 2.09999999999999993e-114 < x Initial program 93.6%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in x around inf 56.8%
if -2.40000000000000013e-54 < x < 2.09999999999999993e-114Initial program 92.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around inf 50.6%
associate-/l*55.3%
Simplified55.3%
Final simplification56.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -4e-53) x (if (<= x 3.8e-114) (/ t (/ a y)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4e-53) {
tmp = x;
} else if (x <= 3.8e-114) {
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 (x <= (-4d-53)) then
tmp = x
else if (x <= 3.8d-114) 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 (x <= -4e-53) {
tmp = x;
} else if (x <= 3.8e-114) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -4e-53: tmp = x elif x <= 3.8e-114: tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4e-53) tmp = x; elseif (x <= 3.8e-114) 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 (x <= -4e-53) tmp = x; elseif (x <= 3.8e-114) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4e-53], x, If[LessEqual[x, 3.8e-114], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-53}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{-114}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -4.00000000000000012e-53 or 3.7999999999999998e-114 < x Initial program 93.6%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in x around inf 56.8%
if -4.00000000000000012e-53 < x < 3.7999999999999998e-114Initial program 92.8%
associate-/l*95.6%
Simplified95.6%
Taylor expanded in t around inf 50.6%
associate-/l*55.3%
Simplified55.3%
clear-num55.3%
un-div-inv55.6%
Applied egg-rr55.6%
Final simplification56.4%
(FPCore (x y z t a) :precision binary64 (if (<= a -6e-63) (+ x (* y (/ (- t z) a))) (+ x (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -6e-63) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((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 (a <= (-6d-63)) then
tmp = x + (y * ((t - z) / a))
else
tmp = x + ((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 (a <= -6e-63) {
tmp = x + (y * ((t - z) / a));
} else {
tmp = x + ((y / a) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -6e-63: tmp = x + (y * ((t - z) / a)) else: tmp = x + ((y / a) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -6e-63) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / a))); else tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -6e-63) tmp = x + (y * ((t - z) / a)); else tmp = x + ((y / a) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -6e-63], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{-63}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if a < -5.99999999999999959e-63Initial program 94.3%
associate-/l*99.9%
Simplified99.9%
if -5.99999999999999959e-63 < a Initial program 92.9%
*-commutative92.9%
associate-/l*99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- t z) a))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / 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 * ((t - z) / a))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((t - z) / a));
}
def code(x, y, z, t, a): return x + (y * ((t - z) / a))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(t - z) / a))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((t - z) / a)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{t - z}{a}
\end{array}
Initial program 93.3%
associate-/l*93.2%
Simplified93.2%
Final simplification93.2%
(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.3%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in x around inf 41.1%
Final simplification41.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 2024046
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))