
(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 (cbrt (cbrt (* 0.5 (/ x_m y_m))))))
(if (<= (/ x_m (* y_m 2.0)) 4e+33)
(/ 1.0 (cos (pow (* t_0 (pow t_0 2.0)) 3.0)))
(/ -0.5 (sqrt (cbrt 0.015625))))))x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
double t_0 = cbrt(cbrt((0.5 * (x_m / y_m))));
double tmp;
if ((x_m / (y_m * 2.0)) <= 4e+33) {
tmp = 1.0 / cos(pow((t_0 * pow(t_0, 2.0)), 3.0));
} else {
tmp = -0.5 / 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 t_0 = Math.cbrt(Math.cbrt((0.5 * (x_m / y_m))));
double tmp;
if ((x_m / (y_m * 2.0)) <= 4e+33) {
tmp = 1.0 / Math.cos(Math.pow((t_0 * Math.pow(t_0, 2.0)), 3.0));
} else {
tmp = -0.5 / Math.sqrt(Math.cbrt(0.015625));
}
return tmp;
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) t_0 = cbrt(cbrt(Float64(0.5 * Float64(x_m / y_m)))) tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 4e+33) tmp = Float64(1.0 / cos((Float64(t_0 * (t_0 ^ 2.0)) ^ 3.0))); else tmp = Float64(-0.5 / 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_] := Block[{t$95$0 = N[Power[N[Power[N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 4e+33], N[(1.0 / N[Cos[N[Power[N[(t$95$0 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 / 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}
t_0 := \sqrt[3]{\sqrt[3]{0.5 \cdot \frac{x\_m}{y\_m}}}\\
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 4 \cdot 10^{+33}:\\
\;\;\;\;\frac{1}{\cos \left({\left(t\_0 \cdot {t\_0}^{2}\right)}^{3}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\sqrt{\sqrt[3]{0.015625}}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 3.9999999999999998e33Initial program 52.9%
remove-double-neg52.9%
distribute-frac-neg52.9%
tan-neg52.9%
distribute-frac-neg252.9%
distribute-lft-neg-out52.9%
distribute-frac-neg252.9%
distribute-lft-neg-out52.9%
distribute-frac-neg252.9%
distribute-frac-neg52.9%
neg-mul-152.9%
*-commutative52.9%
associate-/l*52.7%
*-commutative52.7%
associate-/r*52.7%
metadata-eval52.7%
sin-neg52.7%
distribute-frac-neg52.7%
Simplified52.9%
Taylor expanded in x around inf 68.2%
associate-*r/68.2%
*-commutative68.2%
associate-*r/68.3%
Simplified68.3%
add-cube-cbrt68.1%
pow368.3%
Applied egg-rr68.3%
Applied egg-rr68.6%
if 3.9999999999999998e33 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 6.4%
add-cbrt-cube2.8%
pow1/32.0%
pow31.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr1.4%
Taylor expanded in y around -inf 9.3%
add-sqr-sqrt0.0%
sqrt-unprod13.5%
cbrt-unprod13.5%
metadata-eval13.5%
Applied egg-rr13.5%
Final simplification58.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+37) (/ 1.0 (cos (exp (log (* 0.5 (/ x_m y_m)))))) (/ -0.5 (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+37) {
tmp = 1.0 / cos(exp(log((0.5 * (x_m / y_m)))));
} else {
tmp = -0.5 / 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+37) {
tmp = 1.0 / Math.cos(Math.exp(Math.log((0.5 * (x_m / y_m)))));
} else {
tmp = -0.5 / 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+37) tmp = Float64(1.0 / cos(exp(log(Float64(0.5 * Float64(x_m / y_m)))))); else tmp = Float64(-0.5 / 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+37], N[(1.0 / N[Cos[N[Exp[N[Log[N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 / 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^{+37}:\\
\;\;\;\;\frac{1}{\cos \left(e^{\log \left(0.5 \cdot \frac{x\_m}{y\_m}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\sqrt{\sqrt[3]{0.015625}}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 3.99999999999999982e37Initial program 52.6%
remove-double-neg52.6%
distribute-frac-neg52.6%
tan-neg52.6%
distribute-frac-neg252.6%
distribute-lft-neg-out52.6%
distribute-frac-neg252.6%
distribute-lft-neg-out52.6%
distribute-frac-neg252.6%
distribute-frac-neg52.6%
neg-mul-152.6%
*-commutative52.6%
associate-/l*52.5%
*-commutative52.5%
associate-/r*52.5%
metadata-eval52.5%
sin-neg52.5%
distribute-frac-neg52.5%
Simplified52.7%
Taylor expanded in x around inf 67.9%
associate-*r/67.9%
*-commutative67.9%
associate-*r/67.9%
Simplified67.9%
add-cube-cbrt67.8%
pow368.0%
Applied egg-rr68.0%
rem-cube-cbrt67.9%
add-sqr-sqrt43.0%
sqrt-unprod66.8%
swap-sqr56.5%
frac-times56.6%
metadata-eval56.6%
unpow256.6%
add-sqr-sqrt56.5%
swap-sqr62.7%
sqrt-unprod47.6%
add-sqr-sqrt63.6%
sqrt-div64.1%
metadata-eval64.1%
metadata-eval64.1%
sqrt-pow167.9%
metadata-eval67.9%
pow167.9%
associate-/r*67.9%
*-commutative67.9%
add-exp-log40.2%
div-inv40.2%
Applied egg-rr40.2%
if 3.99999999999999982e37 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 6.5%
add-cbrt-cube2.4%
pow1/32.0%
pow31.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr1.4%
Taylor expanded in y around -inf 9.5%
add-sqr-sqrt0.0%
sqrt-unprod13.2%
cbrt-unprod13.2%
metadata-eval13.2%
Applied egg-rr13.2%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 2.2e+33) (log1p (expm1 (/ 1.0 (cos (* (/ x_m y_m) -0.5))))) (/ -0.5 (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)) <= 2.2e+33) {
tmp = log1p(expm1((1.0 / cos(((x_m / y_m) * -0.5)))));
} else {
tmp = -0.5 / 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)) <= 2.2e+33) {
tmp = Math.log1p(Math.expm1((1.0 / Math.cos(((x_m / y_m) * -0.5)))));
} else {
tmp = -0.5 / 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)) <= 2.2e+33) tmp = log1p(expm1(Float64(1.0 / cos(Float64(Float64(x_m / y_m) * -0.5))))); else tmp = Float64(-0.5 / 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], 2.2e+33], N[Log[1 + N[(Exp[N[(1.0 / N[Cos[N[(N[(x$95$m / y$95$m), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision], N[(-0.5 / 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 2.2 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{1}{\cos \left(\frac{x\_m}{y\_m} \cdot -0.5\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\sqrt{\sqrt[3]{0.015625}}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2.19999999999999994e33Initial program 52.9%
remove-double-neg52.9%
distribute-frac-neg52.9%
tan-neg52.9%
distribute-frac-neg252.9%
distribute-lft-neg-out52.9%
distribute-frac-neg252.9%
distribute-lft-neg-out52.9%
distribute-frac-neg252.9%
distribute-frac-neg52.9%
neg-mul-152.9%
*-commutative52.9%
associate-/l*52.7%
*-commutative52.7%
associate-/r*52.7%
metadata-eval52.7%
sin-neg52.7%
distribute-frac-neg52.7%
Simplified52.9%
Taylor expanded in x around inf 68.2%
associate-*r/68.2%
*-commutative68.2%
associate-*r/68.3%
Simplified68.3%
Applied egg-rr68.2%
if 2.19999999999999994e33 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 6.4%
add-cbrt-cube2.8%
pow1/32.0%
pow31.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr1.4%
Taylor expanded in y around -inf 9.3%
add-sqr-sqrt0.0%
sqrt-unprod13.5%
cbrt-unprod13.5%
metadata-eval13.5%
Applied egg-rr13.5%
Final simplification58.1%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (/ (* x_m (pow (cbrt -0.5) 3.0)) y_m))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos(((x_m * pow(cbrt(-0.5), 3.0)) / y_m));
}
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 * Math.pow(Math.cbrt(-0.5), 3.0)) / y_m));
}
x_m = abs(x) y_m = abs(y) function code(x_m, y_m) return Float64(1.0 / cos(Float64(Float64(x_m * (cbrt(-0.5) ^ 3.0)) / 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[(N[(x$95$m * N[Power[N[Power[-0.5, 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision] / y$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x_m = \left|x\right|
\\
y_m = \left|y\right|
\\
\frac{1}{\cos \left(\frac{x\_m \cdot {\left(\sqrt[3]{-0.5}\right)}^{3}}{y\_m}\right)}
\end{array}
Initial program 44.3%
remove-double-neg44.3%
distribute-frac-neg44.3%
tan-neg44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-frac-neg44.3%
neg-mul-144.3%
*-commutative44.3%
associate-/l*44.5%
*-commutative44.5%
associate-/r*44.5%
metadata-eval44.5%
sin-neg44.5%
distribute-frac-neg44.5%
Simplified44.7%
Taylor expanded in x around inf 56.8%
associate-*r/56.8%
*-commutative56.8%
associate-*r/57.2%
Simplified57.2%
add-cube-cbrt57.2%
pow357.4%
Applied egg-rr57.4%
Taylor expanded in x around inf 57.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)) 2.2e+33) (/ 1.0 (cos (* 0.5 (/ x_m y_m)))) (/ -0.5 (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)) <= 2.2e+33) {
tmp = 1.0 / cos((0.5 * (x_m / y_m)));
} else {
tmp = -0.5 / 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)) <= 2.2e+33) {
tmp = 1.0 / Math.cos((0.5 * (x_m / y_m)));
} else {
tmp = -0.5 / 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)) <= 2.2e+33) tmp = Float64(1.0 / cos(Float64(0.5 * Float64(x_m / y_m)))); else tmp = Float64(-0.5 / 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], 2.2e+33], N[(1.0 / N[Cos[N[(0.5 * N[(x$95$m / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-0.5 / 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 2.2 \cdot 10^{+33}:\\
\;\;\;\;\frac{1}{\cos \left(0.5 \cdot \frac{x\_m}{y\_m}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-0.5}{\sqrt{\sqrt[3]{0.015625}}}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2.19999999999999994e33Initial program 52.9%
Taylor expanded in x around inf 68.2%
if 2.19999999999999994e33 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 6.4%
add-cbrt-cube2.8%
pow1/32.0%
pow31.4%
*-un-lft-identity1.4%
*-commutative1.4%
times-frac1.4%
metadata-eval1.4%
Applied egg-rr1.4%
Taylor expanded in y around -inf 9.3%
add-sqr-sqrt0.0%
sqrt-unprod13.5%
cbrt-unprod13.5%
metadata-eval13.5%
Applied egg-rr13.5%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (/ 1.0 (cos (/ 1.0 (* y_m (/ 2.0 x_m))))))
x_m = fabs(x);
y_m = fabs(y);
double code(double x_m, double y_m) {
return 1.0 / cos((1.0 / (y_m * (2.0 / x_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 / (y_m * (2.0d0 / x_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 / (y_m * (2.0 / x_m))));
}
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 * (2.0 / x_m))))
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(2.0 / x_m))))) end
x_m = abs(x); y_m = abs(y); function tmp = code(x_m, y_m) tmp = 1.0 / cos((1.0 / (y_m * (2.0 / x_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[(y$95$m * N[(2.0 / x$95$m), $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{2}{x\_m}}\right)}
\end{array}
Initial program 44.3%
remove-double-neg44.3%
distribute-frac-neg44.3%
tan-neg44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-frac-neg44.3%
neg-mul-144.3%
*-commutative44.3%
associate-/l*44.5%
*-commutative44.5%
associate-/r*44.5%
metadata-eval44.5%
sin-neg44.5%
distribute-frac-neg44.5%
Simplified44.7%
Taylor expanded in x around inf 56.8%
associate-*r/56.8%
*-commutative56.8%
associate-*r/57.2%
Simplified57.2%
add-cube-cbrt57.2%
pow357.4%
Applied egg-rr57.4%
rem-cube-cbrt57.2%
add-sqr-sqrt35.3%
sqrt-unprod55.3%
swap-sqr46.5%
frac-times46.6%
metadata-eval46.6%
unpow246.6%
add-sqr-sqrt46.5%
swap-sqr51.7%
sqrt-unprod39.2%
add-sqr-sqrt52.9%
sqrt-div53.3%
metadata-eval53.3%
metadata-eval53.3%
sqrt-pow157.2%
metadata-eval57.2%
pow157.2%
associate-/r*57.2%
*-commutative57.2%
div-inv56.8%
clear-num56.9%
associate-/l*57.2%
Applied egg-rr57.2%
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 44.3%
remove-double-neg44.3%
distribute-frac-neg44.3%
tan-neg44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-frac-neg44.3%
neg-mul-144.3%
*-commutative44.3%
associate-/l*44.5%
*-commutative44.5%
associate-/r*44.5%
metadata-eval44.5%
sin-neg44.5%
distribute-frac-neg44.5%
Simplified44.7%
Taylor expanded in x around inf 56.8%
associate-*r/56.8%
*-commutative56.8%
associate-*r/57.2%
Simplified57.2%
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 44.3%
Taylor expanded in x around inf 56.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 44.3%
remove-double-neg44.3%
distribute-frac-neg44.3%
tan-neg44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-lft-neg-out44.3%
distribute-frac-neg244.3%
distribute-frac-neg44.3%
neg-mul-144.3%
*-commutative44.3%
associate-/l*44.5%
*-commutative44.5%
associate-/r*44.5%
metadata-eval44.5%
sin-neg44.5%
distribute-frac-neg44.5%
Simplified44.7%
Taylor expanded in x around 0 56.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 44.3%
Taylor expanded in x around inf 44.1%
*-commutative44.1%
associate-*l/44.3%
associate-*r/44.4%
*-commutative44.4%
associate-*l/44.4%
associate-*r/44.5%
Simplified44.5%
metadata-eval44.5%
associate-/r*44.5%
*-commutative44.5%
div-inv44.7%
add-cube-cbrt43.5%
pow344.0%
Applied egg-rr3.8%
Taylor expanded in x around 0 6.8%
rem-cube-cbrt6.8%
metadata-eval6.8%
Simplified6.8%
(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 2024133
(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)))))