
(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 11 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 (<= y -2e-122) (+ x (/ y (/ a (- t z)))) (+ x (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2e-122) {
tmp = x + (y / (a / (t - z)));
} 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 (y <= (-2d-122)) then
tmp = x + (y / (a / (t - z)))
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 (y <= -2e-122) {
tmp = x + (y / (a / (t - z)));
} else {
tmp = x + ((y / a) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2e-122: tmp = x + (y / (a / (t - z))) else: tmp = x + ((y / a) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2e-122) tmp = Float64(x + Float64(y / Float64(a / Float64(t - z)))); 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 (y <= -2e-122) tmp = x + (y / (a / (t - z))); else tmp = x + ((y / a) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2e-122], N[(x + N[(y / N[(a / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2 \cdot 10^{-122}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t - z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if y < -2.00000000000000012e-122Initial program 90.0%
associate-/l*98.7%
Simplified98.7%
clear-num98.7%
un-div-inv99.6%
Applied egg-rr99.6%
if -2.00000000000000012e-122 < y Initial program 97.2%
*-commutative97.2%
associate-/l*98.8%
Applied egg-rr98.8%
Final simplification99.0%
(FPCore (x y z t a)
:precision binary64
(if (<= x -3.35e-76)
x
(if (<= x 2.5e-171)
(* t (/ y a))
(if (<= x 3.6e-100)
(* y (/ z (- a)))
(if (<= x 0.047) (/ t (/ a y)) x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.35e-76) {
tmp = x;
} else if (x <= 2.5e-171) {
tmp = t * (y / a);
} else if (x <= 3.6e-100) {
tmp = y * (z / -a);
} else if (x <= 0.047) {
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 <= (-3.35d-76)) then
tmp = x
else if (x <= 2.5d-171) then
tmp = t * (y / a)
else if (x <= 3.6d-100) then
tmp = y * (z / -a)
else if (x <= 0.047d0) 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 <= -3.35e-76) {
tmp = x;
} else if (x <= 2.5e-171) {
tmp = t * (y / a);
} else if (x <= 3.6e-100) {
tmp = y * (z / -a);
} else if (x <= 0.047) {
tmp = t / (a / y);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.35e-76: tmp = x elif x <= 2.5e-171: tmp = t * (y / a) elif x <= 3.6e-100: tmp = y * (z / -a) elif x <= 0.047: tmp = t / (a / y) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.35e-76) tmp = x; elseif (x <= 2.5e-171) tmp = Float64(t * Float64(y / a)); elseif (x <= 3.6e-100) tmp = Float64(y * Float64(z / Float64(-a))); elseif (x <= 0.047) 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 <= -3.35e-76) tmp = x; elseif (x <= 2.5e-171) tmp = t * (y / a); elseif (x <= 3.6e-100) tmp = y * (z / -a); elseif (x <= 0.047) tmp = t / (a / y); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.35e-76], x, If[LessEqual[x, 2.5e-171], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.6e-100], N[(y * N[(z / (-a)), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.047], N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision], x]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.35 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.5 \cdot 10^{-171}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;x \leq 3.6 \cdot 10^{-100}:\\
\;\;\;\;y \cdot \frac{z}{-a}\\
\mathbf{elif}\;x \leq 0.047:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.35000000000000018e-76 or 0.047 < x Initial program 95.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in x around inf 64.3%
if -3.35000000000000018e-76 < x < 2.49999999999999996e-171Initial program 92.9%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in t around inf 45.3%
*-commutative45.3%
Simplified45.3%
*-commutative45.3%
associate-/l*53.4%
*-commutative53.4%
Applied egg-rr53.4%
if 2.49999999999999996e-171 < x < 3.5999999999999999e-100Initial program 99.8%
associate-/l*93.2%
Simplified93.2%
Taylor expanded in z around inf 72.5%
mul-1-neg72.5%
associate-/l*65.9%
distribute-rgt-neg-in65.9%
distribute-neg-frac265.9%
Simplified65.9%
if 3.5999999999999999e-100 < x < 0.047Initial program 91.7%
associate-/l*77.3%
Simplified77.3%
Taylor expanded in t around inf 43.2%
*-commutative43.2%
Simplified43.2%
associate-/l*43.2%
*-commutative43.2%
Applied egg-rr43.2%
associate-/r/51.0%
Applied egg-rr51.0%
Final simplification60.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -3.9e-76) x (if (<= x 6.4e-171) (* t (/ y a)) (if (<= x 0.005) (* z (/ y (- a))) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -3.9e-76) {
tmp = x;
} else if (x <= 6.4e-171) {
tmp = t * (y / a);
} else if (x <= 0.005) {
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 <= (-3.9d-76)) then
tmp = x
else if (x <= 6.4d-171) then
tmp = t * (y / a)
else if (x <= 0.005d0) 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 <= -3.9e-76) {
tmp = x;
} else if (x <= 6.4e-171) {
tmp = t * (y / a);
} else if (x <= 0.005) {
tmp = z * (y / -a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -3.9e-76: tmp = x elif x <= 6.4e-171: tmp = t * (y / a) elif x <= 0.005: tmp = z * (y / -a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -3.9e-76) tmp = x; elseif (x <= 6.4e-171) tmp = Float64(t * Float64(y / a)); elseif (x <= 0.005) 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 <= -3.9e-76) tmp = x; elseif (x <= 6.4e-171) tmp = t * (y / a); elseif (x <= 0.005) tmp = z * (y / -a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -3.9e-76], x, If[LessEqual[x, 6.4e-171], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.005], N[(z * N[(y / (-a)), $MachinePrecision]), $MachinePrecision], x]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.9 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 6.4 \cdot 10^{-171}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;x \leq 0.005:\\
\;\;\;\;z \cdot \frac{y}{-a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.90000000000000025e-76 or 0.0050000000000000001 < x Initial program 95.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in x around inf 64.3%
if -3.90000000000000025e-76 < x < 6.4000000000000003e-171Initial program 92.9%
associate-/l*94.0%
Simplified94.0%
Taylor expanded in t around inf 45.3%
*-commutative45.3%
Simplified45.3%
*-commutative45.3%
associate-/l*53.4%
*-commutative53.4%
Applied egg-rr53.4%
if 6.4000000000000003e-171 < x < 0.0050000000000000001Initial program 96.0%
*-commutative96.0%
associate-/l*99.8%
Applied egg-rr99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 55.4%
mul-1-neg55.4%
associate-*l/62.5%
distribute-rgt-neg-out62.5%
Simplified62.5%
Final simplification60.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.5e+97) (not (<= z 8.2e+102))) (* (/ y a) (- t z)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.5e+97) || !(z <= 8.2e+102)) {
tmp = (y / a) * (t - z);
} 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 <= (-4.5d+97)) .or. (.not. (z <= 8.2d+102))) then
tmp = (y / a) * (t - z)
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 <= -4.5e+97) || !(z <= 8.2e+102)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.5e+97) or not (z <= 8.2e+102): tmp = (y / a) * (t - z) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.5e+97) || !(z <= 8.2e+102)) tmp = Float64(Float64(y / a) * Float64(t - z)); 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 <= -4.5e+97) || ~((z <= 8.2e+102))) tmp = (y / a) * (t - z); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.5e+97], N[Not[LessEqual[z, 8.2e+102]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.5 \cdot 10^{+97} \lor \neg \left(z \leq 8.2 \cdot 10^{+102}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -4.49999999999999976e97 or 8.1999999999999999e102 < z Initial program 90.3%
*-commutative90.3%
associate-/l*97.5%
Applied egg-rr97.5%
Taylor expanded in x around 0 67.2%
mul-1-neg67.2%
*-commutative67.2%
associate-*r/74.1%
*-commutative74.1%
sub-neg74.1%
distribute-rgt-out66.5%
+-commutative66.5%
distribute-lft-neg-out66.5%
associate-*r/64.2%
mul-1-neg64.2%
distribute-neg-in64.2%
associate-*r/66.5%
distribute-lft-neg-in66.5%
metadata-eval66.5%
*-lft-identity66.5%
sub-neg66.5%
distribute-rgt-out--74.1%
Simplified74.1%
if -4.49999999999999976e97 < z < 8.1999999999999999e102Initial program 96.7%
sub-neg96.7%
distribute-frac-neg296.7%
+-commutative96.7%
associate-/l*96.7%
fma-define96.7%
distribute-frac-neg296.7%
distribute-neg-frac96.7%
sub-neg96.7%
distribute-neg-in96.7%
remove-double-neg96.7%
+-commutative96.7%
sub-neg96.7%
Simplified96.7%
Taylor expanded in z around 0 84.3%
Final simplification81.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.2e+32) (not (<= t 9.8e+42))) (+ x (/ (* y t) a)) (- x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.2e+32) || !(t <= 9.8e+42)) {
tmp = x + ((y * t) / 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 <= (-1.2d+32)) .or. (.not. (t <= 9.8d+42))) then
tmp = x + ((y * t) / 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 <= -1.2e+32) || !(t <= 9.8e+42)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.2e+32) or not (t <= 9.8e+42): tmp = x + ((y * t) / a) else: tmp = x - (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.2e+32) || !(t <= 9.8e+42)) tmp = Float64(x + Float64(Float64(y * t) / 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 <= -1.2e+32) || ~((t <= 9.8e+42))) tmp = x + ((y * t) / a); else tmp = x - (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.2e+32], N[Not[LessEqual[t, 9.8e+42]], $MachinePrecision]], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.2 \cdot 10^{+32} \lor \neg \left(t \leq 9.8 \cdot 10^{+42}\right):\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -1.19999999999999996e32 or 9.8000000000000004e42 < t Initial program 93.9%
sub-neg93.9%
distribute-frac-neg293.9%
+-commutative93.9%
associate-/l*92.2%
fma-define92.2%
distribute-frac-neg292.2%
distribute-neg-frac92.2%
sub-neg92.2%
distribute-neg-in92.2%
remove-double-neg92.2%
+-commutative92.2%
sub-neg92.2%
Simplified92.2%
Taylor expanded in z around 0 87.4%
if -1.19999999999999996e32 < t < 9.8000000000000004e42Initial program 95.4%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in z around inf 88.0%
associate-/l*88.0%
Simplified88.0%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (<= x -8e+35) x (if (<= x 330000000.0) (* (/ y a) (- t z)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -8e+35) {
tmp = x;
} else if (x <= 330000000.0) {
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 (x <= (-8d+35)) then
tmp = x
else if (x <= 330000000.0d0) 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 (x <= -8e+35) {
tmp = x;
} else if (x <= 330000000.0) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -8e+35: tmp = x elif x <= 330000000.0: tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -8e+35) tmp = x; elseif (x <= 330000000.0) 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 (x <= -8e+35) tmp = x; elseif (x <= 330000000.0) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -8e+35], x, If[LessEqual[x, 330000000.0], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{+35}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 330000000:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.9999999999999997e35 or 3.3e8 < x Initial program 95.6%
associate-/l*96.3%
Simplified96.3%
Taylor expanded in x around inf 67.7%
if -7.9999999999999997e35 < x < 3.3e8Initial program 93.8%
*-commutative93.8%
associate-/l*96.0%
Applied egg-rr96.0%
Taylor expanded in x around 0 74.9%
mul-1-neg74.9%
*-commutative74.9%
associate-*r/77.1%
*-commutative77.1%
sub-neg77.1%
distribute-rgt-out73.1%
+-commutative73.1%
distribute-lft-neg-out73.1%
associate-*r/70.3%
mul-1-neg70.3%
distribute-neg-in70.3%
associate-*r/73.1%
distribute-lft-neg-in73.1%
metadata-eval73.1%
*-lft-identity73.1%
sub-neg73.1%
distribute-rgt-out--77.1%
Simplified77.1%
Final simplification72.3%
(FPCore (x y z t a) :precision binary64 (if (<= x -4e-76) x (if (<= x 5.5e-7) (* y (/ t a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -4e-76) {
tmp = x;
} else if (x <= 5.5e-7) {
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 <= (-4d-76)) then
tmp = x
else if (x <= 5.5d-7) 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 <= -4e-76) {
tmp = x;
} else if (x <= 5.5e-7) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -4e-76: tmp = x elif x <= 5.5e-7: tmp = y * (t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -4e-76) tmp = x; elseif (x <= 5.5e-7) 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 <= -4e-76) tmp = x; elseif (x <= 5.5e-7) tmp = y * (t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -4e-76], x, If[LessEqual[x, 5.5e-7], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 5.5 \cdot 10^{-7}:\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -3.99999999999999971e-76 or 5.5000000000000003e-7 < x Initial program 95.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in x around inf 64.3%
if -3.99999999999999971e-76 < x < 5.5000000000000003e-7Initial program 93.7%
associate-/l*92.0%
Simplified92.0%
Taylor expanded in t around inf 43.3%
*-commutative43.3%
associate-/l*44.2%
Simplified44.2%
Final simplification55.9%
(FPCore (x y z t a) :precision binary64 (if (<= x -7.2e-76) x (if (<= x 340000000.0) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -7.2e-76) {
tmp = x;
} else if (x <= 340000000.0) {
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 <= (-7.2d-76)) then
tmp = x
else if (x <= 340000000.0d0) 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 <= -7.2e-76) {
tmp = x;
} else if (x <= 340000000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -7.2e-76: tmp = x elif x <= 340000000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -7.2e-76) tmp = x; elseif (x <= 340000000.0) 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 <= -7.2e-76) tmp = x; elseif (x <= 340000000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -7.2e-76], x, If[LessEqual[x, 340000000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.2 \cdot 10^{-76}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 340000000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -7.2000000000000001e-76 or 3.4e8 < x Initial program 95.5%
associate-/l*96.1%
Simplified96.1%
Taylor expanded in x around inf 64.3%
if -7.2000000000000001e-76 < x < 3.4e8Initial program 93.7%
associate-/l*92.0%
Simplified92.0%
Taylor expanded in t around inf 43.3%
*-commutative43.3%
Simplified43.3%
*-commutative43.3%
associate-/l*50.3%
*-commutative50.3%
Applied egg-rr50.3%
Final simplification58.4%
(FPCore (x y z t a) :precision binary64 (if (<= y -2e-23) (+ 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 (y <= -2e-23) {
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 (y <= (-2d-23)) 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 (y <= -2e-23) {
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 y <= -2e-23: 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 (y <= -2e-23) 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 (y <= -2e-23) 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[y, -2e-23], 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}\;y \leq -2 \cdot 10^{-23}:\\
\;\;\;\;x + y \cdot \frac{t - z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if y < -1.99999999999999992e-23Initial program 87.3%
associate-/l*99.8%
Simplified99.8%
if -1.99999999999999992e-23 < y Initial program 97.4%
*-commutative97.4%
associate-/l*98.4%
Applied egg-rr98.4%
Final simplification98.7%
(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 94.7%
associate-/l*94.4%
Simplified94.4%
Final simplification94.4%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 94.7%
associate-/l*94.4%
Simplified94.4%
Taylor expanded in x around inf 44.6%
Final simplification44.6%
(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 2024054
(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)))