
(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 8 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
(if (<= (/ x_m (* y_m 2.0)) 1e+253)
(/
1.0
(cos
(* (/ (pow (cbrt x_m) 2.0) -2.0) (/ (pow (cbrt (cbrt x_m)) 3.0) y_m))))
(* -2.0 (sqrt (cbrt 0.015625)))))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+253) {
tmp = 1.0 / cos(((pow(cbrt(x_m), 2.0) / -2.0) * (pow(cbrt(cbrt(x_m)), 3.0) / y_m)));
} else {
tmp = -2.0 * sqrt(cbrt(0.015625));
}
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+253) {
tmp = 1.0 / Math.cos(((Math.pow(Math.cbrt(x_m), 2.0) / -2.0) * (Math.pow(Math.cbrt(Math.cbrt(x_m)), 3.0) / y_m)));
} else {
tmp = -2.0 * Math.sqrt(Math.cbrt(0.015625));
}
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+253) tmp = Float64(1.0 / cos(Float64(Float64((cbrt(x_m) ^ 2.0) / -2.0) * Float64((cbrt(cbrt(x_m)) ^ 3.0) / y_m)))); else tmp = Float64(-2.0 * sqrt(cbrt(0.015625))); 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+253], N[(1.0 / N[Cos[N[(N[(N[Power[N[Power[x$95$m, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / -2.0), $MachinePrecision] * N[(N[Power[N[Power[N[Power[x$95$m, 1/3], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[Sqrt[N[Power[0.015625, 1/3], $MachinePrecision]], $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^{+253}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{{\left(\sqrt[3]{x\_m}\right)}^{2}}{-2} \cdot \frac{{\left(\sqrt[3]{\sqrt[3]{x\_m}}\right)}^{3}}{y\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \sqrt{\sqrt[3]{0.015625}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.9999999999999994e252Initial program 48.5%
remove-double-neg48.5%
distribute-frac-neg48.5%
tan-neg48.5%
distribute-frac-neg248.5%
distribute-lft-neg-out48.5%
distribute-frac-neg248.5%
distribute-lft-neg-out48.5%
distribute-frac-neg248.5%
distribute-frac-neg48.5%
neg-mul-148.5%
*-commutative48.5%
associate-/l*48.5%
*-commutative48.5%
associate-/r*48.5%
metadata-eval48.5%
sin-neg48.5%
distribute-frac-neg48.5%
Simplified48.7%
Taylor expanded in x around inf 63.3%
associate-*r/63.3%
*-commutative63.3%
associate-*r/63.5%
Simplified63.5%
Taylor expanded in x around inf 63.3%
metadata-eval63.3%
times-frac63.3%
neg-mul-163.3%
*-commutative63.3%
cos-neg63.3%
neg-mul-163.3%
*-commutative63.3%
times-frac63.3%
metadata-eval63.3%
distribute-rgt-neg-in63.3%
metadata-eval63.3%
associate-*l/63.3%
Simplified63.3%
*-un-lft-identity63.3%
times-frac63.5%
metadata-eval63.5%
pow163.5%
metadata-eval63.5%
sqrt-pow159.4%
sqrt-div59.3%
metadata-eval59.3%
unpow259.3%
frac-times59.4%
sqrt-unprod33.9%
add-sqr-sqrt63.5%
times-frac63.3%
*-commutative63.3%
times-frac63.3%
metadata-eval63.3%
metadata-eval63.3%
times-frac63.3%
*-un-lft-identity63.3%
add-cube-cbrt64.0%
times-frac64.2%
pow264.2%
Applied egg-rr64.2%
add-cube-cbrt64.2%
pow364.3%
Applied egg-rr64.3%
if 9.9999999999999994e252 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 5.7%
remove-double-neg5.7%
distribute-frac-neg5.7%
tan-neg5.7%
distribute-frac-neg25.7%
distribute-lft-neg-out5.7%
distribute-frac-neg25.7%
distribute-lft-neg-out5.7%
distribute-frac-neg25.7%
distribute-frac-neg5.7%
neg-mul-15.7%
*-commutative5.7%
associate-/l*6.7%
*-commutative6.7%
associate-/r*6.7%
metadata-eval6.7%
sin-neg6.7%
distribute-frac-neg6.7%
Simplified5.9%
add-cbrt-cube2.4%
pow32.4%
Applied egg-rr2.4%
Taylor expanded in x around 0 11.2%
add-sqr-sqrt0.0%
sqrt-unprod11.4%
cbrt-unprod11.4%
metadata-eval11.4%
Applied egg-rr11.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)) 4e+133) (/ 1.0 (cos (* (/ (pow (cbrt x_m) 2.0) -2.0) (/ (cbrt x_m) y_m)))) (* -2.0 (sqrt (cbrt 0.015625)))))
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)) <= 4e+133) {
tmp = 1.0 / cos(((pow(cbrt(x_m), 2.0) / -2.0) * (cbrt(x_m) / y_m)));
} else {
tmp = -2.0 * sqrt(cbrt(0.015625));
}
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)) <= 4e+133) {
tmp = 1.0 / Math.cos(((Math.pow(Math.cbrt(x_m), 2.0) / -2.0) * (Math.cbrt(x_m) / y_m)));
} else {
tmp = -2.0 * Math.sqrt(Math.cbrt(0.015625));
}
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)) <= 4e+133) tmp = Float64(1.0 / cos(Float64(Float64((cbrt(x_m) ^ 2.0) / -2.0) * Float64(cbrt(x_m) / y_m)))); else tmp = Float64(-2.0 * sqrt(cbrt(0.015625))); 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], 4e+133], N[(1.0 / N[Cos[N[(N[(N[Power[N[Power[x$95$m, 1/3], $MachinePrecision], 2.0], $MachinePrecision] / -2.0), $MachinePrecision] * N[(N[Power[x$95$m, 1/3], $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[Sqrt[N[Power[0.015625, 1/3], $MachinePrecision]], $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 4 \cdot 10^{+133}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{{\left(\sqrt[3]{x\_m}\right)}^{2}}{-2} \cdot \frac{\sqrt[3]{x\_m}}{y\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \sqrt{\sqrt[3]{0.015625}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 4.0000000000000001e133Initial program 51.1%
remove-double-neg51.1%
distribute-frac-neg51.1%
tan-neg51.1%
distribute-frac-neg251.1%
distribute-lft-neg-out51.1%
distribute-frac-neg251.1%
distribute-lft-neg-out51.1%
distribute-frac-neg251.1%
distribute-frac-neg51.1%
neg-mul-151.1%
*-commutative51.1%
associate-/l*50.9%
*-commutative50.9%
associate-/r*50.9%
metadata-eval50.9%
sin-neg50.9%
distribute-frac-neg50.9%
Simplified51.1%
Taylor expanded in x around inf 66.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/66.9%
Simplified66.9%
Taylor expanded in x around inf 66.9%
metadata-eval66.9%
times-frac66.9%
neg-mul-166.9%
*-commutative66.9%
cos-neg66.9%
neg-mul-166.9%
*-commutative66.9%
times-frac66.9%
metadata-eval66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
associate-*l/66.9%
Simplified66.9%
*-un-lft-identity66.9%
times-frac66.9%
metadata-eval66.9%
pow166.9%
metadata-eval66.9%
sqrt-pow162.9%
sqrt-div62.8%
metadata-eval62.8%
unpow262.8%
frac-times62.9%
sqrt-unprod35.8%
add-sqr-sqrt66.9%
times-frac66.9%
*-commutative66.9%
times-frac66.9%
metadata-eval66.9%
metadata-eval66.9%
times-frac66.9%
*-un-lft-identity66.9%
add-cube-cbrt67.6%
times-frac67.7%
pow267.7%
Applied egg-rr67.7%
if 4.0000000000000001e133 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 7.9%
remove-double-neg7.9%
distribute-frac-neg7.9%
tan-neg7.9%
distribute-frac-neg27.9%
distribute-lft-neg-out7.9%
distribute-frac-neg27.9%
distribute-lft-neg-out7.9%
distribute-frac-neg27.9%
distribute-frac-neg7.9%
neg-mul-17.9%
*-commutative7.9%
associate-/l*9.8%
*-commutative9.8%
associate-/r*9.8%
metadata-eval9.8%
sin-neg9.8%
distribute-frac-neg9.8%
Simplified9.1%
add-cbrt-cube2.1%
pow32.1%
Applied egg-rr2.1%
Taylor expanded in x around 0 11.2%
add-sqr-sqrt0.0%
sqrt-unprod12.5%
cbrt-unprod12.5%
metadata-eval12.5%
Applied egg-rr12.5%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 4e+133) (/ 1.0 (cos (/ (pow (cbrt (* x_m 0.5)) 3.0) y_m))) (* -2.0 (sqrt (cbrt 0.015625)))))
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)) <= 4e+133) {
tmp = 1.0 / cos((pow(cbrt((x_m * 0.5)), 3.0) / y_m));
} else {
tmp = -2.0 * sqrt(cbrt(0.015625));
}
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)) <= 4e+133) {
tmp = 1.0 / Math.cos((Math.pow(Math.cbrt((x_m * 0.5)), 3.0) / y_m));
} else {
tmp = -2.0 * Math.sqrt(Math.cbrt(0.015625));
}
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)) <= 4e+133) tmp = Float64(1.0 / cos(Float64((cbrt(Float64(x_m * 0.5)) ^ 3.0) / y_m))); else tmp = Float64(-2.0 * sqrt(cbrt(0.015625))); 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], 4e+133], N[(1.0 / N[Cos[N[(N[Power[N[Power[N[(x$95$m * 0.5), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[Sqrt[N[Power[0.015625, 1/3], $MachinePrecision]], $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 4 \cdot 10^{+133}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{{\left(\sqrt[3]{x\_m \cdot 0.5}\right)}^{3}}{y\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \sqrt{\sqrt[3]{0.015625}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 4.0000000000000001e133Initial program 51.1%
remove-double-neg51.1%
distribute-frac-neg51.1%
tan-neg51.1%
distribute-frac-neg251.1%
distribute-lft-neg-out51.1%
distribute-frac-neg251.1%
distribute-lft-neg-out51.1%
distribute-frac-neg251.1%
distribute-frac-neg51.1%
neg-mul-151.1%
*-commutative51.1%
associate-/l*50.9%
*-commutative50.9%
associate-/r*50.9%
metadata-eval50.9%
sin-neg50.9%
distribute-frac-neg50.9%
Simplified51.1%
Taylor expanded in x around inf 66.9%
associate-*r/66.9%
*-commutative66.9%
associate-*r/66.9%
Simplified66.9%
Taylor expanded in x around inf 66.9%
metadata-eval66.9%
times-frac66.9%
neg-mul-166.9%
*-commutative66.9%
cos-neg66.9%
neg-mul-166.9%
*-commutative66.9%
times-frac66.9%
metadata-eval66.9%
distribute-rgt-neg-in66.9%
metadata-eval66.9%
associate-*l/66.9%
Simplified66.9%
add-cube-cbrt66.8%
pow366.9%
Applied egg-rr66.9%
if 4.0000000000000001e133 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 7.9%
remove-double-neg7.9%
distribute-frac-neg7.9%
tan-neg7.9%
distribute-frac-neg27.9%
distribute-lft-neg-out7.9%
distribute-frac-neg27.9%
distribute-lft-neg-out7.9%
distribute-frac-neg27.9%
distribute-frac-neg7.9%
neg-mul-17.9%
*-commutative7.9%
associate-/l*9.8%
*-commutative9.8%
associate-/r*9.8%
metadata-eval9.8%
sin-neg9.8%
distribute-frac-neg9.8%
Simplified9.1%
add-cbrt-cube2.1%
pow32.1%
Applied egg-rr2.1%
Taylor expanded in x around 0 11.2%
add-sqr-sqrt0.0%
sqrt-unprod12.5%
cbrt-unprod12.5%
metadata-eval12.5%
Applied egg-rr12.5%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 4e+104) (/ 1.0 (cos (* x_m (/ -0.5 y_m)))) (* -2.0 (sqrt (cbrt 0.015625)))))
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)) <= 4e+104) {
tmp = 1.0 / cos((x_m * (-0.5 / y_m)));
} else {
tmp = -2.0 * sqrt(cbrt(0.015625));
}
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)) <= 4e+104) {
tmp = 1.0 / Math.cos((x_m * (-0.5 / y_m)));
} else {
tmp = -2.0 * Math.sqrt(Math.cbrt(0.015625));
}
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)) <= 4e+104) tmp = Float64(1.0 / cos(Float64(x_m * Float64(-0.5 / y_m)))); else tmp = Float64(-2.0 * sqrt(cbrt(0.015625))); 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], 4e+104], N[(1.0 / N[Cos[N[(x$95$m * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[Sqrt[N[Power[0.015625, 1/3], $MachinePrecision]], $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 4 \cdot 10^{+104}:\\
\;\;\;\;\frac{1}{\cos \left(x\_m \cdot \frac{-0.5}{y\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \sqrt{\sqrt[3]{0.015625}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 4e104Initial program 51.8%
remove-double-neg51.8%
distribute-frac-neg51.8%
tan-neg51.8%
distribute-frac-neg251.8%
distribute-lft-neg-out51.8%
distribute-frac-neg251.8%
distribute-lft-neg-out51.8%
distribute-frac-neg251.8%
distribute-frac-neg51.8%
neg-mul-151.8%
*-commutative51.8%
associate-/l*51.6%
*-commutative51.6%
associate-/r*51.6%
metadata-eval51.6%
sin-neg51.6%
distribute-frac-neg51.6%
Simplified51.8%
Taylor expanded in x around inf 67.9%
associate-*r/67.9%
*-commutative67.9%
associate-*r/67.9%
Simplified67.9%
if 4e104 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 8.5%
remove-double-neg8.5%
distribute-frac-neg8.5%
tan-neg8.5%
distribute-frac-neg28.5%
distribute-lft-neg-out8.5%
distribute-frac-neg28.5%
distribute-lft-neg-out8.5%
distribute-frac-neg28.5%
distribute-frac-neg8.5%
neg-mul-18.5%
*-commutative8.5%
associate-/l*10.0%
*-commutative10.0%
associate-/r*10.0%
metadata-eval10.0%
sin-neg10.0%
distribute-frac-neg10.0%
Simplified9.4%
add-cbrt-cube2.8%
pow32.8%
Applied egg-rr2.8%
Taylor expanded in x around 0 11.7%
add-sqr-sqrt0.0%
sqrt-unprod12.5%
cbrt-unprod12.5%
metadata-eval12.5%
Applied egg-rr12.5%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (/ 1.0 (/ 1.0 (* 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((1.0 / (1.0 / (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((1.0d0 / (1.0d0 / (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((1.0 / (1.0 / (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((1.0 / (1.0 / (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(1.0 / Float64(1.0 / 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((1.0 / (1.0 / (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[(1.0 / N[(1.0 / N[(x$95$m * N[(0.5 / y$95$m), $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}{\frac{1}{x\_m \cdot \frac{0.5}{y\_m}}}\right)}
\end{array}
Initial program 45.2%
remove-double-neg45.2%
distribute-frac-neg45.2%
tan-neg45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-frac-neg45.2%
neg-mul-145.2%
*-commutative45.2%
associate-/l*45.3%
*-commutative45.3%
associate-/r*45.3%
metadata-eval45.3%
sin-neg45.3%
distribute-frac-neg45.3%
Simplified45.4%
Taylor expanded in x around inf 58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r/59.0%
Simplified59.0%
associate-*r/58.8%
clear-num58.7%
Applied egg-rr58.7%
clear-num58.9%
associate-*r/59.0%
inv-pow59.0%
rem-cbrt-cube49.3%
rem-cbrt-cube59.0%
add-sqr-sqrt31.5%
sqrt-unprod54.8%
frac-times55.0%
metadata-eval55.0%
unpow255.0%
sqrt-div54.8%
metadata-eval54.8%
sqrt-pow159.0%
metadata-eval59.0%
pow159.0%
associate-/l*58.9%
*-un-lft-identity58.9%
*-commutative58.9%
times-frac58.9%
metadata-eval58.9%
Applied egg-rr58.9%
unpow-158.9%
associate-*r/58.9%
associate-*l/59.0%
*-commutative59.0%
Simplified59.0%
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.2%
remove-double-neg45.2%
distribute-frac-neg45.2%
tan-neg45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-frac-neg45.2%
neg-mul-145.2%
*-commutative45.2%
associate-/l*45.3%
*-commutative45.3%
associate-/r*45.3%
metadata-eval45.3%
sin-neg45.3%
distribute-frac-neg45.3%
Simplified45.4%
Taylor expanded in x around inf 58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r/59.0%
Simplified59.0%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (* 0.5 (/ x_m y_m)))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos((0.5 * (x_m / 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((0.5d0 * (x_m / 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((0.5 * (x_m / y_m)));
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): return 1.0 / math.cos((0.5 * (x_m / y_m)))
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return Float64(1.0 / cos(Float64(0.5 * Float64(x_m / y_m)))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0 / cos((0.5 * (x_m / 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[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\frac{1}{\cos \left(0.5 \cdot \frac{x\_m}{y\_m}\right)}
\end{array}
Initial program 45.2%
Taylor expanded in x around inf 58.8%
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.2%
remove-double-neg45.2%
distribute-frac-neg45.2%
tan-neg45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-lft-neg-out45.2%
distribute-frac-neg245.2%
distribute-frac-neg45.2%
neg-mul-145.2%
*-commutative45.2%
associate-/l*45.3%
*-commutative45.3%
associate-/r*45.3%
metadata-eval45.3%
sin-neg45.3%
distribute-frac-neg45.3%
Simplified45.4%
Taylor expanded in x around 0 58.4%
(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 2024143
(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)))))