
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y 2.0)))) (/ (tan t_0) (sin t_0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
return tan(t_0) / sin(t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = x / (y * 2.0d0)
code = tan(t_0) / sin(t_0)
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
return Math.tan(t_0) / Math.sin(t_0);
}
def code(x, y): t_0 = x / (y * 2.0) return math.tan(t_0) / math.sin(t_0)
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) return Float64(tan(t_0) / sin(t_0)) end
function tmp = code(x, y) t_0 = x / (y * 2.0); tmp = tan(t_0) / sin(t_0); end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (let* ((t_0 (/ x (* y 2.0)))) (/ (tan t_0) (sin t_0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
return tan(t_0) / sin(t_0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
t_0 = x / (y * 2.0d0)
code = tan(t_0) / sin(t_0)
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
return Math.tan(t_0) / Math.sin(t_0);
}
def code(x, y): t_0 = x / (y * 2.0) return math.tan(t_0) / math.sin(t_0)
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) return Float64(tan(t_0) / sin(t_0)) end
function tmp = code(x, y) t_0 = x / (y * 2.0); tmp = tan(t_0) / sin(t_0); end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
\frac{\tan t\_0}{\sin t\_0}
\end{array}
\end{array}
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (pow (pow (* x_m (/ 0.5 y_m)) 1.5) 0.3333333333333333)))
(if (<= (/ x_m (* y_m 2.0)) 5e+170)
(/ 1.0 (cos (* t_0 t_0)))
(* 0.5 (pow (cbrt 2.0) 3.0)))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = pow(pow((x_m * (0.5 / y_m)), 1.5), 0.3333333333333333);
double tmp;
if ((x_m / (y_m * 2.0)) <= 5e+170) {
tmp = 1.0 / cos((t_0 * t_0));
} else {
tmp = 0.5 * pow(cbrt(2.0), 3.0);
}
return tmp;
}
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = Math.pow(Math.pow((x_m * (0.5 / y_m)), 1.5), 0.3333333333333333);
double tmp;
if ((x_m / (y_m * 2.0)) <= 5e+170) {
tmp = 1.0 / Math.cos((t_0 * t_0));
} else {
tmp = 0.5 * Math.pow(Math.cbrt(2.0), 3.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = (Float64(x_m * Float64(0.5 / y_m)) ^ 1.5) ^ 0.3333333333333333 tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 5e+170) tmp = Float64(1.0 / cos(Float64(t_0 * t_0))); else tmp = Float64(0.5 * (cbrt(2.0) ^ 3.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[Power[N[Power[N[(x$95$m * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision]}, If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 5e+170], N[(1.0 / N[Cos[N[(t$95$0 * t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[N[Power[2.0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := {\left({\left(x\_m \cdot \frac{0.5}{y\_m}\right)}^{1.5}\right)}^{0.3333333333333333}\\
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 5 \cdot 10^{+170}:\\
\;\;\;\;\frac{1}{\cos \left(t\_0 \cdot t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\sqrt[3]{2}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 4.99999999999999977e170Initial program 52.5%
remove-double-neg52.5%
distribute-frac-neg52.5%
tan-neg52.5%
distribute-frac-neg252.5%
distribute-lft-neg-out52.5%
distribute-frac-neg252.5%
distribute-lft-neg-out52.5%
distribute-frac-neg252.5%
distribute-frac-neg52.5%
neg-mul-152.5%
*-commutative52.5%
associate-/l*52.2%
*-commutative52.2%
associate-/r*52.2%
metadata-eval52.2%
sin-neg52.2%
distribute-frac-neg52.2%
Simplified52.7%
Taylor expanded in x around inf 61.3%
associate-*r/61.3%
*-commutative61.3%
associate-*r/61.5%
Simplified61.5%
associate-*r/61.3%
add-sqr-sqrt33.2%
associate-/r*33.2%
Applied egg-rr33.2%
associate-/l/33.2%
add-sqr-sqrt61.3%
add-sqr-sqrt35.1%
sqrt-unprod51.5%
swap-sqr51.5%
metadata-eval51.5%
metadata-eval51.5%
swap-sqr51.5%
sqrt-unprod26.1%
add-sqr-sqrt61.3%
*-commutative61.3%
associate-*r/61.3%
rem-cbrt-cube59.4%
unpow1/347.3%
add-sqr-sqrt47.4%
unpow-prod-down47.6%
sqrt-pow136.5%
associate-*r/36.5%
*-commutative36.5%
associate-/l*36.5%
metadata-eval36.5%
Applied egg-rr37.1%
if 4.99999999999999977e170 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 5.4%
add-cube-cbrt4.8%
pow35.3%
Applied egg-rr5.3%
Taylor expanded in x around 0 10.6%
x_m = (fabs.f64 x)
y_m = (fabs.f64 y)
(FPCore (x_m y_m)
:precision binary64
(let* ((t_0 (cbrt (* x_m (/ 0.5 y_m)))) (t_1 (/ x_m (* y_m 2.0))))
(if (<= (/ (tan t_1) (sin t_1)) 1.05)
(/ 1.0 (cos (* t_0 (pow t_0 2.0))))
1.0)))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = cbrt((x_m * (0.5 / y_m)));
double t_1 = x_m / (y_m * 2.0);
double tmp;
if ((tan(t_1) / sin(t_1)) <= 1.05) {
tmp = 1.0 / cos((t_0 * pow(t_0, 2.0)));
} else {
tmp = 1.0;
}
return tmp;
}
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = Math.cbrt((x_m * (0.5 / y_m)));
double t_1 = x_m / (y_m * 2.0);
double tmp;
if ((Math.tan(t_1) / Math.sin(t_1)) <= 1.05) {
tmp = 1.0 / Math.cos((t_0 * Math.pow(t_0, 2.0)));
} else {
tmp = 1.0;
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = cbrt(Float64(x_m * Float64(0.5 / y_m))) t_1 = Float64(x_m / Float64(y_m * 2.0)) tmp = 0.0 if (Float64(tan(t_1) / sin(t_1)) <= 1.05) tmp = Float64(1.0 / cos(Float64(t_0 * (t_0 ^ 2.0)))); else tmp = 1.0; end return tmp end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[Power[N[(x$95$m * N[(0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$1 = N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Tan[t$95$1], $MachinePrecision] / N[Sin[t$95$1], $MachinePrecision]), $MachinePrecision], 1.05], N[(1.0 / N[Cos[N[(t$95$0 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \sqrt[3]{x\_m \cdot \frac{0.5}{y\_m}}\\
t_1 := \frac{x\_m}{y\_m \cdot 2}\\
\mathbf{if}\;\frac{\tan t\_1}{\sin t\_1} \leq 1.05:\\
\;\;\;\;\frac{1}{\cos \left(t\_0 \cdot {t\_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) < 1.05000000000000004Initial program 66.7%
remove-double-neg66.7%
distribute-frac-neg66.7%
tan-neg66.7%
distribute-frac-neg266.7%
distribute-lft-neg-out66.7%
distribute-frac-neg266.7%
distribute-lft-neg-out66.7%
distribute-frac-neg266.7%
distribute-frac-neg66.7%
neg-mul-166.7%
*-commutative66.7%
associate-/l*66.3%
*-commutative66.3%
associate-/r*66.3%
metadata-eval66.3%
sin-neg66.3%
distribute-frac-neg66.3%
Simplified66.8%
Taylor expanded in x around inf 66.7%
associate-*r/66.7%
*-commutative66.7%
associate-*r/66.8%
Simplified66.8%
associate-*r/66.7%
add-sqr-sqrt36.4%
associate-/r*36.4%
Applied egg-rr36.4%
Applied egg-rr67.5%
if 1.05000000000000004 < (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) Initial program 4.1%
remove-double-neg4.1%
distribute-frac-neg4.1%
tan-neg4.1%
distribute-frac-neg24.1%
distribute-lft-neg-out4.1%
distribute-frac-neg24.1%
distribute-lft-neg-out4.1%
distribute-frac-neg24.1%
distribute-frac-neg4.1%
neg-mul-14.1%
*-commutative4.1%
associate-/l*3.5%
*-commutative3.5%
associate-/r*3.5%
metadata-eval3.5%
sin-neg3.5%
distribute-frac-neg3.5%
Simplified4.2%
Taylor expanded in x around 0 30.1%
Final simplification54.6%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (* (/ 1.0 (pow y_m 0.25)) (/ (* x_m (/ -0.5 (sqrt y_m))) (pow y_m 0.25))))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos(((1.0 / pow(y_m, 0.25)) * ((x_m * (-0.5 / sqrt(y_m))) / pow(y_m, 0.25))));
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
code = 1.0d0 / cos(((1.0d0 / (y_m ** 0.25d0)) * ((x_m * ((-0.5d0) / sqrt(y_m))) / (y_m ** 0.25d0))))
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
return 1.0 / Math.cos(((1.0 / Math.pow(y_m, 0.25)) * ((x_m * (-0.5 / Math.sqrt(y_m))) / Math.pow(y_m, 0.25))));
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return 1.0 / math.cos(((1.0 / math.pow(y_m, 0.25)) * ((x_m * (-0.5 / math.sqrt(y_m))) / math.pow(y_m, 0.25))))
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return Float64(1.0 / cos(Float64(Float64(1.0 / (y_m ^ 0.25)) * Float64(Float64(x_m * Float64(-0.5 / sqrt(y_m))) / (y_m ^ 0.25))))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0 / cos(((1.0 / (y_m ^ 0.25)) * ((x_m * (-0.5 / sqrt(y_m))) / (y_m ^ 0.25)))); end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := N[(1.0 / N[Cos[N[(N[(1.0 / N[Power[y$95$m, 0.25], $MachinePrecision]), $MachinePrecision] * N[(N[(x$95$m * N[(-0.5 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[y$95$m, 0.25], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\frac{1}{\cos \left(\frac{1}{{y\_m}^{0.25}} \cdot \frac{x\_m \cdot \frac{-0.5}{\sqrt{y\_m}}}{{y\_m}^{0.25}}\right)}
\end{array}
Initial program 45.1%
remove-double-neg45.1%
distribute-frac-neg45.1%
tan-neg45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-frac-neg45.1%
neg-mul-145.1%
*-commutative45.1%
associate-/l*44.7%
*-commutative44.7%
associate-/r*44.7%
metadata-eval44.7%
sin-neg44.7%
distribute-frac-neg44.7%
Simplified45.3%
Taylor expanded in x around inf 52.6%
associate-*r/52.6%
*-commutative52.6%
associate-*r/52.7%
Simplified52.7%
associate-*r/52.6%
add-sqr-sqrt28.5%
associate-/r*28.5%
Applied egg-rr28.5%
*-un-lft-identity28.5%
add-sqr-sqrt28.4%
times-frac28.4%
pow1/228.4%
sqrt-pow128.6%
metadata-eval28.6%
associate-/l*28.3%
pow1/228.3%
sqrt-pow128.4%
metadata-eval28.4%
Applied egg-rr28.4%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 1e+187) (/ 1.0 (cos (/ (* x_m (/ 0.5 (sqrt y_m))) (sqrt y_m)))) (* 0.5 (pow (cbrt 2.0) 3.0))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / cos(((x_m * (0.5 / sqrt(y_m))) / sqrt(y_m)));
} else {
tmp = 0.5 * pow(cbrt(2.0), 3.0);
}
return tmp;
}
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / Math.cos(((x_m * (0.5 / Math.sqrt(y_m))) / Math.sqrt(y_m)));
} else {
tmp = 0.5 * Math.pow(Math.cbrt(2.0), 3.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 1e+187) tmp = Float64(1.0 / cos(Float64(Float64(x_m * Float64(0.5 / sqrt(y_m))) / sqrt(y_m)))); else tmp = Float64(0.5 * (cbrt(2.0) ^ 3.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+187], N[(1.0 / N[Cos[N[(N[(x$95$m * N[(0.5 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[N[Power[2.0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+187}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{x\_m \cdot \frac{0.5}{\sqrt{y\_m}}}{\sqrt{y\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\sqrt[3]{2}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.99999999999999907e186Initial program 51.9%
remove-double-neg51.9%
distribute-frac-neg51.9%
tan-neg51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-frac-neg51.9%
neg-mul-151.9%
*-commutative51.9%
associate-/l*51.6%
*-commutative51.6%
associate-/r*51.6%
metadata-eval51.6%
sin-neg51.6%
distribute-frac-neg51.6%
Simplified52.1%
Taylor expanded in x around inf 60.6%
associate-*r/60.6%
*-commutative60.6%
associate-*r/60.8%
Simplified60.8%
associate-*r/60.6%
add-sqr-sqrt32.9%
associate-/r*32.9%
Applied egg-rr32.9%
add-sqr-sqrt18.4%
sqrt-unprod27.8%
swap-sqr27.8%
metadata-eval27.8%
metadata-eval27.8%
swap-sqr27.8%
sqrt-unprod13.7%
add-sqr-sqrt32.9%
metadata-eval32.9%
distribute-rgt-neg-in32.9%
distribute-neg-frac32.9%
neg-sub032.9%
associate-/l*32.8%
Applied egg-rr32.8%
neg-sub032.8%
distribute-rgt-neg-in32.8%
distribute-neg-frac32.8%
metadata-eval32.8%
Simplified32.8%
if 9.99999999999999907e186 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 5.2%
add-cube-cbrt5.1%
pow35.6%
Applied egg-rr5.6%
Taylor expanded in x around 0 10.3%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 1e+187) (/ 1.0 (cos (* (/ 0.5 (sqrt y_m)) (/ x_m (sqrt y_m))))) (* 0.5 (pow (cbrt 2.0) 3.0))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / cos(((0.5 / sqrt(y_m)) * (x_m / sqrt(y_m))));
} else {
tmp = 0.5 * pow(cbrt(2.0), 3.0);
}
return tmp;
}
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / Math.cos(((0.5 / Math.sqrt(y_m)) * (x_m / Math.sqrt(y_m))));
} else {
tmp = 0.5 * Math.pow(Math.cbrt(2.0), 3.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 1e+187) tmp = Float64(1.0 / cos(Float64(Float64(0.5 / sqrt(y_m)) * Float64(x_m / sqrt(y_m))))); else tmp = Float64(0.5 * (cbrt(2.0) ^ 3.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+187], N[(1.0 / N[Cos[N[(N[(0.5 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] * N[(x$95$m / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[N[Power[2.0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+187}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{0.5}{\sqrt{y\_m}} \cdot \frac{x\_m}{\sqrt{y\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\sqrt[3]{2}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.99999999999999907e186Initial program 51.9%
remove-double-neg51.9%
distribute-frac-neg51.9%
tan-neg51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-frac-neg51.9%
neg-mul-151.9%
*-commutative51.9%
associate-/l*51.6%
*-commutative51.6%
associate-/r*51.6%
metadata-eval51.6%
sin-neg51.6%
distribute-frac-neg51.6%
Simplified52.1%
Taylor expanded in x around inf 60.6%
associate-*r/60.6%
*-commutative60.6%
associate-*r/60.8%
Simplified60.8%
associate-*r/60.6%
add-sqr-sqrt32.9%
associate-/r*32.9%
Applied egg-rr32.9%
associate-/l/32.9%
add-sqr-sqrt18.5%
sqrt-unprod27.8%
swap-sqr27.8%
metadata-eval27.8%
metadata-eval27.8%
swap-sqr27.8%
sqrt-unprod13.7%
add-sqr-sqrt32.9%
times-frac32.9%
Applied egg-rr32.9%
if 9.99999999999999907e186 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 5.2%
add-cube-cbrt5.1%
pow35.6%
Applied egg-rr5.6%
Taylor expanded in x around 0 10.3%
Final simplification29.7%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (let* ((t_0 (sqrt (/ x_m y_m)))) (/ 1.0 (cos (* t_0 (* 0.5 t_0))))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = sqrt((x_m / y_m));
return 1.0 / cos((t_0 * (0.5 * t_0)));
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
real(8) :: t_0
t_0 = sqrt((x_m / y_m))
code = 1.0d0 / cos((t_0 * (0.5d0 * t_0)))
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double t_0 = Math.sqrt((x_m / y_m));
return 1.0 / Math.cos((t_0 * (0.5 * t_0)));
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): t_0 = math.sqrt((x_m / y_m)) return 1.0 / math.cos((t_0 * (0.5 * t_0)))
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = sqrt(Float64(x_m / y_m)) return Float64(1.0 / cos(Float64(t_0 * Float64(0.5 * t_0)))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) t_0 = sqrt((x_m / y_m)); tmp = 1.0 / cos((t_0 * (0.5 * t_0))); end
x_m = N[Abs[x], $MachinePrecision]
y_m = N[Abs[y], $MachinePrecision]
code[x$95$m_, y$95$m_] := Block[{t$95$0 = N[Sqrt[N[(x$95$m / y$95$m), $MachinePrecision]], $MachinePrecision]}, N[(1.0 / N[Cos[N[(t$95$0 * N[(0.5 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \sqrt{\frac{x\_m}{y\_m}}\\
\frac{1}{\cos \left(t\_0 \cdot \left(0.5 \cdot t\_0\right)\right)}
\end{array}
\end{array}
Initial program 45.1%
remove-double-neg45.1%
distribute-frac-neg45.1%
tan-neg45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-frac-neg45.1%
neg-mul-145.1%
*-commutative45.1%
associate-/l*44.7%
*-commutative44.7%
associate-/r*44.7%
metadata-eval44.7%
sin-neg44.7%
distribute-frac-neg44.7%
Simplified45.3%
Taylor expanded in x around inf 52.6%
associate-*r/52.6%
*-commutative52.6%
associate-*r/52.7%
Simplified52.7%
associate-*r/52.6%
add-sqr-sqrt28.5%
associate-/r*28.5%
Applied egg-rr28.5%
associate-/l/28.5%
add-sqr-sqrt15.8%
sqrt-unprod24.0%
swap-sqr24.0%
metadata-eval24.0%
metadata-eval24.0%
swap-sqr24.0%
sqrt-unprod12.1%
add-sqr-sqrt28.5%
*-commutative28.5%
add-sqr-sqrt52.6%
associate-*r/52.6%
add-sqr-sqrt31.9%
associate-*r*31.9%
Applied egg-rr31.9%
Final simplification31.9%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 1e+187) (/ 1.0 (cos (/ 1.0 (* y_m (/ 1.0 (* x_m -0.5)))))) (* 0.5 (pow (cbrt 2.0) 3.0))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / cos((1.0 / (y_m * (1.0 / (x_m * -0.5)))));
} else {
tmp = 0.5 * pow(cbrt(2.0), 3.0);
}
return tmp;
}
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
double tmp;
if ((x_m / (y_m * 2.0)) <= 1e+187) {
tmp = 1.0 / Math.cos((1.0 / (y_m * (1.0 / (x_m * -0.5)))));
} else {
tmp = 0.5 * Math.pow(Math.cbrt(2.0), 3.0);
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 1e+187) tmp = Float64(1.0 / cos(Float64(1.0 / Float64(y_m * Float64(1.0 / Float64(x_m * -0.5)))))); else tmp = Float64(0.5 * (cbrt(2.0) ^ 3.0)); end return tmp end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+187], N[(1.0 / N[Cos[N[(1.0 / N[(y$95$m * N[(1.0 / N[(x$95$m * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[Power[N[Power[2.0, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 10^{+187}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{1}{y\_m \cdot \frac{1}{x\_m \cdot -0.5}}\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot {\left(\sqrt[3]{2}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.99999999999999907e186Initial program 51.9%
remove-double-neg51.9%
distribute-frac-neg51.9%
tan-neg51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-lft-neg-out51.9%
distribute-frac-neg251.9%
distribute-frac-neg51.9%
neg-mul-151.9%
*-commutative51.9%
associate-/l*51.6%
*-commutative51.6%
associate-/r*51.6%
metadata-eval51.6%
sin-neg51.6%
distribute-frac-neg51.6%
Simplified52.1%
Taylor expanded in x around inf 60.6%
associate-*r/60.6%
*-commutative60.6%
associate-*r/60.8%
Simplified60.8%
associate-*r/60.6%
clear-num60.6%
Applied egg-rr60.6%
div-inv60.9%
Applied egg-rr60.9%
if 9.99999999999999907e186 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 5.2%
add-cube-cbrt5.1%
pow35.6%
Applied egg-rr5.6%
Taylor expanded in x around 0 10.3%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (/ 1.0 (* y_m (/ 1.0 (* x_m -0.5)))))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos((1.0 / (y_m * (1.0 / (x_m * -0.5)))));
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
code = 1.0d0 / cos((1.0d0 / (y_m * (1.0d0 / (x_m * (-0.5d0))))))
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
return 1.0 / Math.cos((1.0 / (y_m * (1.0 / (x_m * -0.5)))));
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return 1.0 / math.cos((1.0 / (y_m * (1.0 / (x_m * -0.5)))))
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return Float64(1.0 / cos(Float64(1.0 / Float64(y_m * Float64(1.0 / Float64(x_m * -0.5)))))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0 / cos((1.0 / (y_m * (1.0 / (x_m * -0.5))))); end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := N[(1.0 / N[Cos[N[(1.0 / N[(y$95$m * N[(1.0 / N[(x$95$m * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\frac{1}{\cos \left(\frac{1}{y\_m \cdot \frac{1}{x\_m \cdot -0.5}}\right)}
\end{array}
Initial program 45.1%
remove-double-neg45.1%
distribute-frac-neg45.1%
tan-neg45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-frac-neg45.1%
neg-mul-145.1%
*-commutative45.1%
associate-/l*44.7%
*-commutative44.7%
associate-/r*44.7%
metadata-eval44.7%
sin-neg44.7%
distribute-frac-neg44.7%
Simplified45.3%
Taylor expanded in x around inf 52.6%
associate-*r/52.6%
*-commutative52.6%
associate-*r/52.7%
Simplified52.7%
associate-*r/52.6%
clear-num52.7%
Applied egg-rr52.7%
div-inv52.9%
Applied egg-rr52.9%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (* x_m (/ -0.5 y_m)))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos((x_m * (-0.5 / y_m)));
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
code = 1.0d0 / cos((x_m * ((-0.5d0) / y_m)))
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
return 1.0 / Math.cos((x_m * (-0.5 / y_m)));
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return 1.0 / math.cos((x_m * (-0.5 / y_m)))
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return Float64(1.0 / cos(Float64(x_m * Float64(-0.5 / y_m)))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0 / cos((x_m * (-0.5 / y_m))); end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := N[(1.0 / N[Cos[N[(x$95$m * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\frac{1}{\cos \left(x\_m \cdot \frac{-0.5}{y\_m}\right)}
\end{array}
Initial program 45.1%
remove-double-neg45.1%
distribute-frac-neg45.1%
tan-neg45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-frac-neg45.1%
neg-mul-145.1%
*-commutative45.1%
associate-/l*44.7%
*-commutative44.7%
associate-/r*44.7%
metadata-eval44.7%
sin-neg44.7%
distribute-frac-neg44.7%
Simplified45.3%
Taylor expanded in x around inf 52.6%
associate-*r/52.6%
*-commutative52.6%
associate-*r/52.7%
Simplified52.7%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 1.0)
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0;
}
x_m = abs(x)
y_m = abs(y)
real(8) function code(x_m, y_m)
real(8), intent (in) :: x_m
real(8), intent (in) :: y_m
code = 1.0d0
end function
x_m = Math.abs(x);
y_m = Math.abs(y);
public static double code(double x_m, double y_m) {
return 1.0;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return 1.0
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return 1.0 end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0; end
x_m = N[Abs[x], $MachinePrecision] y_m = N[Abs[y], $MachinePrecision] code[x$95$m_, y$95$m_] := 1.0
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
1
\end{array}
Initial program 45.1%
remove-double-neg45.1%
distribute-frac-neg45.1%
tan-neg45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-lft-neg-out45.1%
distribute-frac-neg245.1%
distribute-frac-neg45.1%
neg-mul-145.1%
*-commutative45.1%
associate-/l*44.7%
*-commutative44.7%
associate-/r*44.7%
metadata-eval44.7%
sin-neg44.7%
distribute-frac-neg44.7%
Simplified45.3%
Taylor expanded in x around 0 52.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y 2.0))) (t_1 (sin t_0)))
(if (< y -1.2303690911306994e+114)
1.0
(if (< y -9.102852406811914e-222)
(/ t_1 (* t_1 (log (exp (cos t_0)))))
1.0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
double t_1 = sin(t_0);
double tmp;
if (y < -1.2303690911306994e+114) {
tmp = 1.0;
} else if (y < -9.102852406811914e-222) {
tmp = t_1 / (t_1 * log(exp(cos(t_0))));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y * 2.0d0)
t_1 = sin(t_0)
if (y < (-1.2303690911306994d+114)) then
tmp = 1.0d0
else if (y < (-9.102852406811914d-222)) then
tmp = t_1 / (t_1 * log(exp(cos(t_0))))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
double t_1 = Math.sin(t_0);
double tmp;
if (y < -1.2303690911306994e+114) {
tmp = 1.0;
} else if (y < -9.102852406811914e-222) {
tmp = t_1 / (t_1 * Math.log(Math.exp(Math.cos(t_0))));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * 2.0) t_1 = math.sin(t_0) tmp = 0 if y < -1.2303690911306994e+114: tmp = 1.0 elif y < -9.102852406811914e-222: tmp = t_1 / (t_1 * math.log(math.exp(math.cos(t_0)))) else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) t_1 = sin(t_0) tmp = 0.0 if (y < -1.2303690911306994e+114) tmp = 1.0; elseif (y < -9.102852406811914e-222) tmp = Float64(t_1 / Float64(t_1 * log(exp(cos(t_0))))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * 2.0); t_1 = sin(t_0); tmp = 0.0; if (y < -1.2303690911306994e+114) tmp = 1.0; elseif (y < -9.102852406811914e-222) tmp = t_1 / (t_1 * log(exp(cos(t_0)))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, If[Less[y, -1.2303690911306994e+114], 1.0, If[Less[y, -9.102852406811914e-222], N[(t$95$1 / N[(t$95$1 * N[Log[N[Exp[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
t_1 := \sin t\_0\\
\mathbf{if}\;y < -1.2303690911306994 \cdot 10^{+114}:\\
\;\;\;\;1\\
\mathbf{elif}\;y < -9.102852406811914 \cdot 10^{-222}:\\
\;\;\;\;\frac{t\_1}{t\_1 \cdot \log \left(e^{\cos t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
herbie shell --seed 2024116
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(! :herbie-platform default (if (< y -1230369091130699400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) 1 (if (< y -4551426203405957/500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (sin (/ x (* y 2))) (* (sin (/ x (* y 2))) (log (exp (cos (/ x (* y 2))))))) 1)))
(/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))