
(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 (if (<= y -8.2e-83) (- x (/ y (/ a (- z t)))) (+ x (/ (- t z) (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -8.2e-83) {
tmp = x - (y / (a / (z - t)));
} 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 (y <= (-8.2d-83)) then
tmp = x - (y / (a / (z - t)))
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 (y <= -8.2e-83) {
tmp = x - (y / (a / (z - t)));
} else {
tmp = x + ((t - z) / (a / y));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -8.2e-83: tmp = x - (y / (a / (z - t))) else: tmp = x + ((t - z) / (a / y)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -8.2e-83) tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); 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 (y <= -8.2e-83) tmp = x - (y / (a / (z - t))); else tmp = x + ((t - z) / (a / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -8.2e-83], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.2 \cdot 10^{-83}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\end{array}
\end{array}
if y < -8.1999999999999999e-83Initial program 85.1%
associate-/l*99.8%
Simplified99.8%
if -8.1999999999999999e-83 < y Initial program 95.5%
associate-*l/97.4%
Simplified97.4%
Taylor expanded in y around 0 95.5%
*-commutative95.5%
associate-/l*97.4%
Simplified97.4%
Final simplification98.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- y) a))))
(if (<= a -4.4e-45)
x
(if (<= a 6.8e-224)
t_1
(if (<= a 1.36e-165)
(/ (* y t) a)
(if (<= a 6.5e-49) t_1 (if (<= a 5500000.0) (* t (/ y a)) x)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (a <= -4.4e-45) {
tmp = x;
} else if (a <= 6.8e-224) {
tmp = t_1;
} else if (a <= 1.36e-165) {
tmp = (y * t) / a;
} else if (a <= 6.5e-49) {
tmp = t_1;
} else if (a <= 5500000.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) :: t_1
real(8) :: tmp
t_1 = z * (-y / a)
if (a <= (-4.4d-45)) then
tmp = x
else if (a <= 6.8d-224) then
tmp = t_1
else if (a <= 1.36d-165) then
tmp = (y * t) / a
else if (a <= 6.5d-49) then
tmp = t_1
else if (a <= 5500000.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 t_1 = z * (-y / a);
double tmp;
if (a <= -4.4e-45) {
tmp = x;
} else if (a <= 6.8e-224) {
tmp = t_1;
} else if (a <= 1.36e-165) {
tmp = (y * t) / a;
} else if (a <= 6.5e-49) {
tmp = t_1;
} else if (a <= 5500000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / a) tmp = 0 if a <= -4.4e-45: tmp = x elif a <= 6.8e-224: tmp = t_1 elif a <= 1.36e-165: tmp = (y * t) / a elif a <= 6.5e-49: tmp = t_1 elif a <= 5500000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / a)) tmp = 0.0 if (a <= -4.4e-45) tmp = x; elseif (a <= 6.8e-224) tmp = t_1; elseif (a <= 1.36e-165) tmp = Float64(Float64(y * t) / a); elseif (a <= 6.5e-49) tmp = t_1; elseif (a <= 5500000.0) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (-y / a); tmp = 0.0; if (a <= -4.4e-45) tmp = x; elseif (a <= 6.8e-224) tmp = t_1; elseif (a <= 1.36e-165) tmp = (y * t) / a; elseif (a <= 6.5e-49) tmp = t_1; elseif (a <= 5500000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -4.4e-45], x, If[LessEqual[a, 6.8e-224], t$95$1, If[LessEqual[a, 1.36e-165], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 6.5e-49], t$95$1, If[LessEqual[a, 5500000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{a}\\
\mathbf{if}\;a \leq -4.4 \cdot 10^{-45}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6.8 \cdot 10^{-224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.36 \cdot 10^{-165}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 5500000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.39999999999999987e-45 or 5.5e6 < a Initial program 86.0%
sub-neg86.0%
distribute-frac-neg86.0%
distribute-lft-neg-out86.0%
+-commutative86.0%
distribute-lft-neg-out86.0%
distribute-rgt-neg-in86.0%
associate-*l/97.6%
fma-def97.6%
sub-neg97.6%
distribute-neg-in97.6%
remove-double-neg97.6%
+-commutative97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in y around 0 58.7%
if -4.39999999999999987e-45 < a < 6.79999999999999984e-224 or 1.3599999999999999e-165 < a < 6.49999999999999968e-49Initial program 98.9%
sub-neg98.9%
distribute-frac-neg98.9%
distribute-lft-neg-out98.9%
+-commutative98.9%
distribute-lft-neg-out98.9%
distribute-rgt-neg-in98.9%
associate-*l/95.1%
fma-def95.1%
sub-neg95.1%
distribute-neg-in95.1%
remove-double-neg95.1%
+-commutative95.1%
sub-neg95.1%
Simplified95.1%
Taylor expanded in z around inf 61.5%
mul-1-neg61.5%
associate-*l/60.6%
*-commutative60.6%
Simplified60.6%
if 6.79999999999999984e-224 < a < 1.3599999999999999e-165Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
distribute-lft-neg-out99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
associate-*l/87.2%
fma-def87.2%
sub-neg87.2%
distribute-neg-in87.2%
remove-double-neg87.2%
+-commutative87.2%
sub-neg87.2%
Simplified87.2%
Taylor expanded in t around inf 51.4%
if 6.49999999999999968e-49 < a < 5.5e6Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-lft-neg-out100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
fma-def100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 75.8%
associate-*r/75.8%
Simplified75.8%
Final simplification59.6%
(FPCore (x y z t a)
:precision binary64
(if (<= a -8e+38)
x
(if (<= a 4.5e-226)
(/ (- z) (/ a y))
(if (<= a 2.65e-160)
(/ (* y t) a)
(if (<= a 5e-50)
(* z (/ (- y) a))
(if (<= a 5800000.0) (* t (/ y a)) x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -8e+38) {
tmp = x;
} else if (a <= 4.5e-226) {
tmp = -z / (a / y);
} else if (a <= 2.65e-160) {
tmp = (y * t) / a;
} else if (a <= 5e-50) {
tmp = z * (-y / a);
} else if (a <= 5800000.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 (a <= (-8d+38)) then
tmp = x
else if (a <= 4.5d-226) then
tmp = -z / (a / y)
else if (a <= 2.65d-160) then
tmp = (y * t) / a
else if (a <= 5d-50) then
tmp = z * (-y / a)
else if (a <= 5800000.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 (a <= -8e+38) {
tmp = x;
} else if (a <= 4.5e-226) {
tmp = -z / (a / y);
} else if (a <= 2.65e-160) {
tmp = (y * t) / a;
} else if (a <= 5e-50) {
tmp = z * (-y / a);
} else if (a <= 5800000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -8e+38: tmp = x elif a <= 4.5e-226: tmp = -z / (a / y) elif a <= 2.65e-160: tmp = (y * t) / a elif a <= 5e-50: tmp = z * (-y / a) elif a <= 5800000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -8e+38) tmp = x; elseif (a <= 4.5e-226) tmp = Float64(Float64(-z) / Float64(a / y)); elseif (a <= 2.65e-160) tmp = Float64(Float64(y * t) / a); elseif (a <= 5e-50) tmp = Float64(z * Float64(Float64(-y) / a)); elseif (a <= 5800000.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 (a <= -8e+38) tmp = x; elseif (a <= 4.5e-226) tmp = -z / (a / y); elseif (a <= 2.65e-160) tmp = (y * t) / a; elseif (a <= 5e-50) tmp = z * (-y / a); elseif (a <= 5800000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -8e+38], x, If[LessEqual[a, 4.5e-226], N[((-z) / N[(a / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.65e-160], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 5e-50], N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5800000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+38}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 4.5 \cdot 10^{-226}:\\
\;\;\;\;\frac{-z}{\frac{a}{y}}\\
\mathbf{elif}\;a \leq 2.65 \cdot 10^{-160}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 5 \cdot 10^{-50}:\\
\;\;\;\;z \cdot \frac{-y}{a}\\
\mathbf{elif}\;a \leq 5800000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -7.99999999999999982e38 or 5.8e6 < a Initial program 85.5%
sub-neg85.5%
distribute-frac-neg85.5%
distribute-lft-neg-out85.5%
+-commutative85.5%
distribute-lft-neg-out85.5%
distribute-rgt-neg-in85.5%
associate-*l/97.5%
fma-def97.5%
sub-neg97.5%
distribute-neg-in97.5%
remove-double-neg97.5%
+-commutative97.5%
sub-neg97.5%
Simplified97.5%
Taylor expanded in y around 0 60.6%
if -7.99999999999999982e38 < a < 4.50000000000000011e-226Initial program 97.8%
sub-neg97.8%
distribute-frac-neg97.8%
distribute-lft-neg-out97.8%
+-commutative97.8%
distribute-lft-neg-out97.8%
distribute-rgt-neg-in97.8%
associate-*l/94.6%
fma-def94.6%
sub-neg94.6%
distribute-neg-in94.6%
remove-double-neg94.6%
+-commutative94.6%
sub-neg94.6%
Simplified94.6%
Taylor expanded in z around inf 57.7%
mul-1-neg57.7%
*-commutative57.7%
associate-/l*57.5%
associate-/r/50.3%
Simplified50.3%
associate-/r/57.5%
Applied egg-rr57.5%
if 4.50000000000000011e-226 < a < 2.6500000000000001e-160Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
distribute-lft-neg-out99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
associate-*l/87.2%
fma-def87.2%
sub-neg87.2%
distribute-neg-in87.2%
remove-double-neg87.2%
+-commutative87.2%
sub-neg87.2%
Simplified87.2%
Taylor expanded in t around inf 51.4%
if 2.6500000000000001e-160 < a < 4.99999999999999968e-50Initial program 99.8%
sub-neg99.8%
distribute-frac-neg99.8%
distribute-lft-neg-out99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
associate-*l/99.9%
fma-def100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 61.1%
mul-1-neg61.1%
associate-*l/66.0%
*-commutative66.0%
Simplified66.0%
if 4.99999999999999968e-50 < a < 5.8e6Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-lft-neg-out100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
fma-def100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 75.8%
associate-*r/75.8%
Simplified75.8%
Final simplification59.9%
(FPCore (x y z t a)
:precision binary64
(if (<= a -1.05e-43)
x
(if (<= a 7.6e-224)
(/ (* z (- y)) a)
(if (<= a 5.2e-158)
(/ (* y t) a)
(if (<= a 9.5e-50)
(* z (/ (- y) a))
(if (<= a 6800000.0) (* t (/ y a)) x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.05e-43) {
tmp = x;
} else if (a <= 7.6e-224) {
tmp = (z * -y) / a;
} else if (a <= 5.2e-158) {
tmp = (y * t) / a;
} else if (a <= 9.5e-50) {
tmp = z * (-y / a);
} else if (a <= 6800000.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 (a <= (-1.05d-43)) then
tmp = x
else if (a <= 7.6d-224) then
tmp = (z * -y) / a
else if (a <= 5.2d-158) then
tmp = (y * t) / a
else if (a <= 9.5d-50) then
tmp = z * (-y / a)
else if (a <= 6800000.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 (a <= -1.05e-43) {
tmp = x;
} else if (a <= 7.6e-224) {
tmp = (z * -y) / a;
} else if (a <= 5.2e-158) {
tmp = (y * t) / a;
} else if (a <= 9.5e-50) {
tmp = z * (-y / a);
} else if (a <= 6800000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.05e-43: tmp = x elif a <= 7.6e-224: tmp = (z * -y) / a elif a <= 5.2e-158: tmp = (y * t) / a elif a <= 9.5e-50: tmp = z * (-y / a) elif a <= 6800000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.05e-43) tmp = x; elseif (a <= 7.6e-224) tmp = Float64(Float64(z * Float64(-y)) / a); elseif (a <= 5.2e-158) tmp = Float64(Float64(y * t) / a); elseif (a <= 9.5e-50) tmp = Float64(z * Float64(Float64(-y) / a)); elseif (a <= 6800000.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 (a <= -1.05e-43) tmp = x; elseif (a <= 7.6e-224) tmp = (z * -y) / a; elseif (a <= 5.2e-158) tmp = (y * t) / a; elseif (a <= 9.5e-50) tmp = z * (-y / a); elseif (a <= 6800000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.05e-43], x, If[LessEqual[a, 7.6e-224], N[(N[(z * (-y)), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 5.2e-158], N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[a, 9.5e-50], N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6800000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.05 \cdot 10^{-43}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 7.6 \cdot 10^{-224}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{a}\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-158}:\\
\;\;\;\;\frac{y \cdot t}{a}\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-50}:\\
\;\;\;\;z \cdot \frac{-y}{a}\\
\mathbf{elif}\;a \leq 6800000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.05e-43 or 6.8e6 < a Initial program 86.0%
sub-neg86.0%
distribute-frac-neg86.0%
distribute-lft-neg-out86.0%
+-commutative86.0%
distribute-lft-neg-out86.0%
distribute-rgt-neg-in86.0%
associate-*l/97.6%
fma-def97.6%
sub-neg97.6%
distribute-neg-in97.6%
remove-double-neg97.6%
+-commutative97.6%
sub-neg97.6%
Simplified97.6%
Taylor expanded in y around 0 58.7%
if -1.05e-43 < a < 7.60000000000000005e-224Initial program 98.7%
sub-neg98.7%
distribute-frac-neg98.7%
distribute-lft-neg-out98.7%
+-commutative98.7%
distribute-lft-neg-out98.7%
distribute-rgt-neg-in98.7%
associate-*l/93.9%
fma-def93.9%
sub-neg93.9%
distribute-neg-in93.9%
remove-double-neg93.9%
+-commutative93.9%
sub-neg93.9%
Simplified93.9%
Taylor expanded in z around inf 61.6%
mul-1-neg61.6%
*-commutative61.6%
associate-/l*60.3%
associate-/r/52.1%
Simplified52.1%
associate-*l/61.6%
Applied egg-rr61.6%
if 7.60000000000000005e-224 < a < 5.2000000000000001e-158Initial program 99.9%
sub-neg99.9%
distribute-frac-neg99.9%
distribute-lft-neg-out99.9%
+-commutative99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
associate-*l/87.2%
fma-def87.2%
sub-neg87.2%
distribute-neg-in87.2%
remove-double-neg87.2%
+-commutative87.2%
sub-neg87.2%
Simplified87.2%
Taylor expanded in t around inf 51.4%
if 5.2000000000000001e-158 < a < 9.4999999999999993e-50Initial program 99.8%
sub-neg99.8%
distribute-frac-neg99.8%
distribute-lft-neg-out99.8%
+-commutative99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
associate-*l/99.9%
fma-def100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in z around inf 61.1%
mul-1-neg61.1%
associate-*l/66.0%
*-commutative66.0%
Simplified66.0%
if 9.4999999999999993e-50 < a < 6.8e6Initial program 100.0%
sub-neg100.0%
distribute-frac-neg100.0%
distribute-lft-neg-out100.0%
+-commutative100.0%
distribute-lft-neg-out100.0%
distribute-rgt-neg-in100.0%
associate-*l/100.0%
fma-def100.0%
sub-neg100.0%
distribute-neg-in100.0%
remove-double-neg100.0%
+-commutative100.0%
sub-neg100.0%
Simplified100.0%
Taylor expanded in t around inf 75.8%
associate-*r/75.8%
Simplified75.8%
Final simplification60.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e+177) (not (<= z 6e+28))) (/ (- z) (/ a y)) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e+177) || !(z <= 6e+28)) {
tmp = -z / (a / y);
} 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 <= (-7.2d+177)) .or. (.not. (z <= 6d+28))) then
tmp = -z / (a / y)
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 <= -7.2e+177) || !(z <= 6e+28)) {
tmp = -z / (a / y);
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e+177) or not (z <= 6e+28): tmp = -z / (a / y) else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e+177) || !(z <= 6e+28)) tmp = Float64(Float64(-z) / Float64(a / y)); 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 <= -7.2e+177) || ~((z <= 6e+28))) tmp = -z / (a / y); else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e+177], N[Not[LessEqual[z, 6e+28]], $MachinePrecision]], N[((-z) / N[(a / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+177} \lor \neg \left(z \leq 6 \cdot 10^{+28}\right):\\
\;\;\;\;\frac{-z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -7.20000000000000005e177 or 6.0000000000000002e28 < z Initial program 86.4%
sub-neg86.4%
distribute-frac-neg86.4%
distribute-lft-neg-out86.4%
+-commutative86.4%
distribute-lft-neg-out86.4%
distribute-rgt-neg-in86.4%
associate-*l/96.6%
fma-def96.6%
sub-neg96.6%
distribute-neg-in96.6%
remove-double-neg96.6%
+-commutative96.6%
sub-neg96.6%
Simplified96.6%
Taylor expanded in z around inf 60.8%
mul-1-neg60.8%
*-commutative60.8%
associate-/l*66.9%
associate-/r/57.6%
Simplified57.6%
associate-/r/66.9%
Applied egg-rr66.9%
if -7.20000000000000005e177 < z < 6.0000000000000002e28Initial program 95.3%
sub-neg95.3%
distribute-frac-neg95.3%
distribute-lft-neg-out95.3%
+-commutative95.3%
distribute-lft-neg-out95.3%
distribute-rgt-neg-in95.3%
associate-*l/95.9%
fma-def95.9%
sub-neg95.9%
distribute-neg-in95.9%
remove-double-neg95.9%
+-commutative95.9%
sub-neg95.9%
Simplified95.9%
Taylor expanded in z around 0 79.2%
Final simplification74.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.4e+39) (not (<= t 2.2e-61))) (+ x (/ (* y t) a)) (- x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.4e+39) || !(t <= 2.2e-61)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y / (a / 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 ((t <= (-3.4d+39)) .or. (.not. (t <= 2.2d-61))) then
tmp = x + ((y * t) / a)
else
tmp = x - (y / (a / z))
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+39) || !(t <= 2.2e-61)) {
tmp = x + ((y * t) / a);
} else {
tmp = x - (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.4e+39) or not (t <= 2.2e-61): tmp = x + ((y * t) / a) else: tmp = x - (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.4e+39) || !(t <= 2.2e-61)) tmp = Float64(x + Float64(Float64(y * t) / a)); else tmp = Float64(x - Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.4e+39) || ~((t <= 2.2e-61))) tmp = x + ((y * t) / a); else tmp = x - (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.4e+39], N[Not[LessEqual[t, 2.2e-61]], $MachinePrecision]], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+39} \lor \neg \left(t \leq 2.2 \cdot 10^{-61}\right):\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -3.3999999999999999e39 or 2.20000000000000009e-61 < t Initial program 91.6%
sub-neg91.6%
distribute-frac-neg91.6%
distribute-lft-neg-out91.6%
+-commutative91.6%
distribute-lft-neg-out91.6%
distribute-rgt-neg-in91.6%
associate-*l/99.2%
fma-def99.2%
sub-neg99.2%
distribute-neg-in99.2%
remove-double-neg99.2%
+-commutative99.2%
sub-neg99.2%
Simplified99.2%
Taylor expanded in z around 0 79.7%
if -3.3999999999999999e39 < t < 2.20000000000000009e-61Initial program 92.7%
associate-/l*94.8%
Simplified94.8%
Taylor expanded in z around inf 89.1%
Final simplification84.5%
(FPCore (x y z t a) :precision binary64 (if (<= y -4.5e-95) (- x (/ y (/ a (- z t)))) (+ x (* (/ y a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -4.5e-95) {
tmp = x - (y / (a / (z - t)));
} 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 <= (-4.5d-95)) then
tmp = x - (y / (a / (z - t)))
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 <= -4.5e-95) {
tmp = x - (y / (a / (z - t)));
} else {
tmp = x + ((y / a) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -4.5e-95: tmp = x - (y / (a / (z - t))) else: tmp = x + ((y / a) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -4.5e-95) tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); 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 <= -4.5e-95) tmp = x - (y / (a / (z - t))); else tmp = x + ((y / a) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -4.5e-95], N[(x - N[(y / N[(a / N[(z - t), $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 -4.5 \cdot 10^{-95}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if y < -4.5e-95Initial program 85.9%
associate-/l*99.9%
Simplified99.9%
if -4.5e-95 < y Initial program 95.4%
associate-*l/97.3%
Simplified97.3%
Final simplification98.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -4.5e-95) x (if (<= a 17000000.0) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -4.5e-95) {
tmp = x;
} else if (a <= 17000000.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 (a <= (-4.5d-95)) then
tmp = x
else if (a <= 17000000.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 (a <= -4.5e-95) {
tmp = x;
} else if (a <= 17000000.0) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -4.5e-95: tmp = x elif a <= 17000000.0: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -4.5e-95) tmp = x; elseif (a <= 17000000.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 (a <= -4.5e-95) tmp = x; elseif (a <= 17000000.0) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -4.5e-95], x, If[LessEqual[a, 17000000.0], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -4.5 \cdot 10^{-95}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 17000000:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -4.5e-95 or 1.7e7 < a Initial program 86.8%
sub-neg86.8%
distribute-frac-neg86.8%
distribute-lft-neg-out86.8%
+-commutative86.8%
distribute-lft-neg-out86.8%
distribute-rgt-neg-in86.8%
associate-*l/97.1%
fma-def97.1%
sub-neg97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
+-commutative97.1%
sub-neg97.1%
Simplified97.1%
Taylor expanded in y around 0 56.9%
if -4.5e-95 < a < 1.7e7Initial program 99.0%
sub-neg99.0%
distribute-frac-neg99.0%
distribute-lft-neg-out99.0%
+-commutative99.0%
distribute-lft-neg-out99.0%
distribute-rgt-neg-in99.0%
associate-*l/95.0%
fma-def95.0%
sub-neg95.0%
distribute-neg-in95.0%
remove-double-neg95.0%
+-commutative95.0%
sub-neg95.0%
Simplified95.0%
Taylor expanded in t around inf 40.9%
associate-*r/43.3%
Simplified43.3%
Final simplification50.9%
(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 92.2%
associate-*l/96.2%
Simplified96.2%
Final simplification96.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 92.2%
sub-neg92.2%
distribute-frac-neg92.2%
distribute-lft-neg-out92.2%
+-commutative92.2%
distribute-lft-neg-out92.2%
distribute-rgt-neg-in92.2%
associate-*l/96.2%
fma-def96.2%
sub-neg96.2%
distribute-neg-in96.2%
remove-double-neg96.2%
+-commutative96.2%
sub-neg96.2%
Simplified96.2%
Taylor expanded in y around 0 39.4%
Final simplification39.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 2023271
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:herbie-target
(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)))