
(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)) 2e+159)
(/
1.0
(cos
(/
(pow
(* (cbrt -0.5) (* (pow (/ 1.0 y_m) 0.16666666666666666) (cbrt x_m)))
3.0)
(sqrt y_m))))
1.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)) <= 2e+159) {
tmp = 1.0 / cos((pow((cbrt(-0.5) * (pow((1.0 / y_m), 0.16666666666666666) * cbrt(x_m))), 3.0) / sqrt(y_m)));
} 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 tmp;
if ((x_m / (y_m * 2.0)) <= 2e+159) {
tmp = 1.0 / Math.cos((Math.pow((Math.cbrt(-0.5) * (Math.pow((1.0 / y_m), 0.16666666666666666) * Math.cbrt(x_m))), 3.0) / Math.sqrt(y_m)));
} else {
tmp = 1.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)) <= 2e+159) tmp = Float64(1.0 / cos(Float64((Float64(cbrt(-0.5) * Float64((Float64(1.0 / y_m) ^ 0.16666666666666666) * cbrt(x_m))) ^ 3.0) / sqrt(y_m)))); 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_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 2e+159], N[(1.0 / N[Cos[N[(N[Power[N[(N[Power[-0.5, 1/3], $MachinePrecision] * N[(N[Power[N[(1.0 / y$95$m), $MachinePrecision], 0.16666666666666666], $MachinePrecision] * N[Power[x$95$m, 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\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 \cdot 10^{+159}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{{\left(\sqrt[3]{-0.5} \cdot \left({\left(\frac{1}{y\_m}\right)}^{0.16666666666666666} \cdot \sqrt[3]{x\_m}\right)\right)}^{3}}{\sqrt{y\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 1.9999999999999999e159Initial 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.7%
*-commutative50.7%
associate-/r*50.7%
metadata-eval50.7%
sin-neg50.7%
distribute-frac-neg50.7%
Simplified51.4%
Taylor expanded in x around inf 62.6%
associate-*r/62.6%
*-commutative62.6%
associate-*r/62.5%
Simplified62.5%
associate-*r/62.6%
add-sqr-sqrt32.4%
associate-/r*32.1%
Applied egg-rr32.1%
add-cube-cbrt32.5%
pow332.3%
associate-/l*32.5%
Applied egg-rr32.5%
Taylor expanded in x around 0 32.4%
associate-*r*32.7%
*-commutative32.7%
Simplified32.7%
if 1.9999999999999999e159 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 3.5%
remove-double-neg3.5%
distribute-frac-neg3.5%
tan-neg3.5%
distribute-frac-neg23.5%
distribute-lft-neg-out3.5%
distribute-frac-neg23.5%
distribute-lft-neg-out3.5%
distribute-frac-neg23.5%
distribute-frac-neg3.5%
neg-mul-13.5%
*-commutative3.5%
associate-/l*3.7%
*-commutative3.7%
associate-/r*3.7%
metadata-eval3.7%
sin-neg3.7%
distribute-frac-neg3.7%
Simplified3.2%
Taylor expanded in x around 0 12.3%
Final simplification29.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)) 5e+149)
(/
1.0
(cos
(* (/ 1.0 (cbrt y_m)) (/ (* x_m (/ -0.5 (sqrt y_m))) (cbrt (sqrt y_m))))))
1.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)) <= 5e+149) {
tmp = 1.0 / cos(((1.0 / cbrt(y_m)) * ((x_m * (-0.5 / sqrt(y_m))) / cbrt(sqrt(y_m)))));
} 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 tmp;
if ((x_m / (y_m * 2.0)) <= 5e+149) {
tmp = 1.0 / Math.cos(((1.0 / Math.cbrt(y_m)) * ((x_m * (-0.5 / Math.sqrt(y_m))) / Math.cbrt(Math.sqrt(y_m)))));
} else {
tmp = 1.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)) <= 5e+149) tmp = Float64(1.0 / cos(Float64(Float64(1.0 / cbrt(y_m)) * Float64(Float64(x_m * Float64(-0.5 / sqrt(y_m))) / cbrt(sqrt(y_m)))))); 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_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 5e+149], N[(1.0 / N[Cos[N[(N[(1.0 / N[Power[y$95$m, 1/3], $MachinePrecision]), $MachinePrecision] * N[(N[(x$95$m * N[(-0.5 / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sqrt[y$95$m], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\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 5 \cdot 10^{+149}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{1}{\sqrt[3]{y\_m}} \cdot \frac{x\_m \cdot \frac{-0.5}{\sqrt{y\_m}}}{\sqrt[3]{\sqrt{y\_m}}}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 4.9999999999999999e149Initial program 51.5%
remove-double-neg51.5%
distribute-frac-neg51.5%
tan-neg51.5%
distribute-frac-neg251.5%
distribute-lft-neg-out51.5%
distribute-frac-neg251.5%
distribute-lft-neg-out51.5%
distribute-frac-neg251.5%
distribute-frac-neg51.5%
neg-mul-151.5%
*-commutative51.5%
associate-/l*51.1%
*-commutative51.1%
associate-/r*51.1%
metadata-eval51.1%
sin-neg51.1%
distribute-frac-neg51.1%
Simplified51.9%
Taylor expanded in x around inf 63.2%
associate-*r/63.2%
*-commutative63.2%
associate-*r/63.1%
Simplified63.1%
associate-*r/63.2%
clear-num63.1%
Applied egg-rr63.1%
clear-num63.2%
add-sqr-sqrt32.7%
associate-/l/32.4%
*-un-lft-identity32.4%
add-cbrt-cube31.7%
add-sqr-sqrt31.8%
cbrt-prod32.4%
times-frac32.4%
associate-/l*32.2%
Applied egg-rr32.2%
if 4.9999999999999999e149 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 3.4%
remove-double-neg3.4%
distribute-frac-neg3.4%
tan-neg3.4%
distribute-frac-neg23.4%
distribute-lft-neg-out3.4%
distribute-frac-neg23.4%
distribute-lft-neg-out3.4%
distribute-frac-neg23.4%
distribute-frac-neg3.4%
neg-mul-13.4%
*-commutative3.4%
associate-/l*3.6%
*-commutative3.6%
associate-/r*3.6%
metadata-eval3.6%
sin-neg3.6%
distribute-frac-neg3.6%
Simplified3.1%
Taylor expanded in x around 0 12.2%
Final simplification29.0%
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)))))
(if (<= (/ x_m (* y_m 2.0)) 2e+143)
(/ 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 tmp;
if ((x_m / (y_m * 2.0)) <= 2e+143) {
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 tmp;
if ((x_m / (y_m * 2.0)) <= 2e+143) {
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))) tmp = 0.0 if (Float64(x_m / Float64(y_m * 2.0)) <= 2e+143) 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]}, If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 2e+143], 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}}\\
\mathbf{if}\;\frac{x\_m}{y\_m \cdot 2} \leq 2 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{\cos \left(t\_0 \cdot {t\_0}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2e143Initial program 51.7%
remove-double-neg51.7%
distribute-frac-neg51.7%
tan-neg51.7%
distribute-frac-neg251.7%
distribute-lft-neg-out51.7%
distribute-frac-neg251.7%
distribute-lft-neg-out51.7%
distribute-frac-neg251.7%
distribute-frac-neg51.7%
neg-mul-151.7%
*-commutative51.7%
associate-/l*51.3%
*-commutative51.3%
associate-/r*51.3%
metadata-eval51.3%
sin-neg51.3%
distribute-frac-neg51.3%
Simplified52.0%
Taylor expanded in x around inf 63.4%
associate-*r/63.4%
*-commutative63.4%
associate-*r/63.3%
Simplified63.3%
associate-*r/63.4%
clear-num63.3%
Applied egg-rr63.3%
add-cube-cbrt63.4%
pow263.4%
clear-num63.1%
associate-/l*63.3%
clear-num63.1%
associate-/l*63.2%
Applied egg-rr63.2%
if 2e143 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 3.7%
remove-double-neg3.7%
distribute-frac-neg3.7%
tan-neg3.7%
distribute-frac-neg23.7%
distribute-lft-neg-out3.7%
distribute-frac-neg23.7%
distribute-lft-neg-out3.7%
distribute-frac-neg23.7%
distribute-frac-neg3.7%
neg-mul-13.7%
*-commutative3.7%
associate-/l*3.9%
*-commutative3.9%
associate-/r*3.9%
metadata-eval3.9%
sin-neg3.9%
distribute-frac-neg3.9%
Simplified3.4%
Taylor expanded in x around 0 12.0%
Final simplification54.6%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 2e+41) (/ 1.0 (cos (/ (/ 1.0 (/ (sqrt y_m) (* x_m -0.5))) (sqrt y_m)))) -1.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)) <= 2e+41) {
tmp = 1.0 / cos(((1.0 / (sqrt(y_m) / (x_m * -0.5))) / sqrt(y_m)));
} else {
tmp = -1.0;
}
return tmp;
}
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) :: tmp
if ((x_m / (y_m * 2.0d0)) <= 2d+41) then
tmp = 1.0d0 / cos(((1.0d0 / (sqrt(y_m) / (x_m * (-0.5d0)))) / sqrt(y_m)))
else
tmp = -1.0d0
end if
code = tmp
end function
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)) <= 2e+41) {
tmp = 1.0 / Math.cos(((1.0 / (Math.sqrt(y_m) / (x_m * -0.5))) / Math.sqrt(y_m)));
} else {
tmp = -1.0;
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): tmp = 0 if (x_m / (y_m * 2.0)) <= 2e+41: tmp = 1.0 / math.cos(((1.0 / (math.sqrt(y_m) / (x_m * -0.5))) / math.sqrt(y_m))) else: tmp = -1.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)) <= 2e+41) tmp = Float64(1.0 / cos(Float64(Float64(1.0 / Float64(sqrt(y_m) / Float64(x_m * -0.5))) / sqrt(y_m)))); else tmp = -1.0; end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) tmp = 0.0; if ((x_m / (y_m * 2.0)) <= 2e+41) tmp = 1.0 / cos(((1.0 / (sqrt(y_m) / (x_m * -0.5))) / sqrt(y_m))); else tmp = -1.0; end tmp_2 = 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], 2e+41], N[(1.0 / N[Cos[N[(N[(1.0 / N[(N[Sqrt[y$95$m], $MachinePrecision] / N[(x$95$m * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -1.0]
\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 \cdot 10^{+41}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{\frac{1}{\frac{\sqrt{y\_m}}{x\_m \cdot -0.5}}}{\sqrt{y\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2.00000000000000001e41Initial program 55.5%
remove-double-neg55.5%
distribute-frac-neg55.5%
tan-neg55.5%
distribute-frac-neg255.5%
distribute-lft-neg-out55.5%
distribute-frac-neg255.5%
distribute-lft-neg-out55.5%
distribute-frac-neg255.5%
distribute-frac-neg55.5%
neg-mul-155.5%
*-commutative55.5%
associate-/l*55.4%
*-commutative55.4%
associate-/r*55.4%
metadata-eval55.4%
sin-neg55.4%
distribute-frac-neg55.4%
Simplified56.1%
Taylor expanded in x around inf 68.4%
associate-*r/68.4%
*-commutative68.4%
associate-*r/68.5%
Simplified68.5%
associate-*r/68.4%
add-sqr-sqrt35.4%
associate-/r*35.1%
Applied egg-rr35.1%
add-cube-cbrt35.6%
pow335.3%
associate-/l*35.4%
Applied egg-rr35.4%
rem-cube-cbrt35.3%
associate-*r/35.1%
clear-num35.6%
Applied egg-rr35.6%
if 2.00000000000000001e41 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 6.4%
remove-double-neg6.4%
distribute-frac-neg6.4%
tan-neg6.4%
distribute-frac-neg26.4%
distribute-lft-neg-out6.4%
distribute-frac-neg26.4%
distribute-lft-neg-out6.4%
distribute-frac-neg26.4%
distribute-frac-neg6.4%
neg-mul-16.4%
*-commutative6.4%
associate-/l*5.4%
*-commutative5.4%
associate-/r*5.4%
metadata-eval5.4%
sin-neg5.4%
distribute-frac-neg5.4%
Simplified5.5%
add-sqr-sqrt0.0%
sqrt-unprod3.6%
pow23.6%
Applied egg-rr3.6%
Taylor expanded in x around 0 13.1%
Final simplification30.1%
x_m = (fabs.f64 x) y_m = (fabs.f64 y) (FPCore (x_m y_m) :precision binary64 (if (<= (/ x_m (* y_m 2.0)) 2e+143) (/ 1.0 (cos (pow (cbrt (* x_m (/ -0.5 y_m))) 3.0))) 1.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)) <= 2e+143) {
tmp = 1.0 / cos(pow(cbrt((x_m * (-0.5 / y_m))), 3.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 tmp;
if ((x_m / (y_m * 2.0)) <= 2e+143) {
tmp = 1.0 / Math.cos(Math.pow(Math.cbrt((x_m * (-0.5 / y_m))), 3.0));
} else {
tmp = 1.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)) <= 2e+143) tmp = Float64(1.0 / cos((cbrt(Float64(x_m * Float64(-0.5 / y_m))) ^ 3.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_] := If[LessEqual[N[(x$95$m / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 2e+143], N[(1.0 / N[Cos[N[Power[N[Power[N[(x$95$m * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\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 \cdot 10^{+143}:\\
\;\;\;\;\frac{1}{\cos \left({\left(\sqrt[3]{x\_m \cdot \frac{-0.5}{y\_m}}\right)}^{3}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 2e143Initial program 51.7%
remove-double-neg51.7%
distribute-frac-neg51.7%
tan-neg51.7%
distribute-frac-neg251.7%
distribute-lft-neg-out51.7%
distribute-frac-neg251.7%
distribute-lft-neg-out51.7%
distribute-frac-neg251.7%
distribute-frac-neg51.7%
neg-mul-151.7%
*-commutative51.7%
associate-/l*51.3%
*-commutative51.3%
associate-/r*51.3%
metadata-eval51.3%
sin-neg51.3%
distribute-frac-neg51.3%
Simplified52.0%
Taylor expanded in x around inf 63.4%
associate-*r/63.4%
*-commutative63.4%
associate-*r/63.3%
Simplified63.3%
add-cube-cbrt63.2%
pow363.0%
Applied egg-rr63.0%
if 2e143 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 3.7%
remove-double-neg3.7%
distribute-frac-neg3.7%
tan-neg3.7%
distribute-frac-neg23.7%
distribute-lft-neg-out3.7%
distribute-frac-neg23.7%
distribute-lft-neg-out3.7%
distribute-frac-neg23.7%
distribute-frac-neg3.7%
neg-mul-13.7%
*-commutative3.7%
associate-/l*3.9%
*-commutative3.9%
associate-/r*3.9%
metadata-eval3.9%
sin-neg3.9%
distribute-frac-neg3.9%
Simplified3.4%
Taylor expanded in x around 0 12.0%
Final simplification54.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)) 2e+194) (/ 1.0 (cos (/ 1.0 (/ 1.0 (/ (* x_m -0.5) y_m))))) 1.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)) <= 2e+194) {
tmp = 1.0 / cos((1.0 / (1.0 / ((x_m * -0.5) / y_m))));
} else {
tmp = 1.0;
}
return tmp;
}
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) :: tmp
if ((x_m / (y_m * 2.0d0)) <= 2d+194) then
tmp = 1.0d0 / cos((1.0d0 / (1.0d0 / ((x_m * (-0.5d0)) / y_m))))
else
tmp = 1.0d0
end if
code = tmp
end function
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)) <= 2e+194) {
tmp = 1.0 / Math.cos((1.0 / (1.0 / ((x_m * -0.5) / y_m))));
} else {
tmp = 1.0;
}
return tmp;
}
x_m = math.fabs(x) y_m = math.fabs(y) def code(x_m, y_m): tmp = 0 if (x_m / (y_m * 2.0)) <= 2e+194: tmp = 1.0 / math.cos((1.0 / (1.0 / ((x_m * -0.5) / y_m)))) else: tmp = 1.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)) <= 2e+194) tmp = Float64(1.0 / cos(Float64(1.0 / Float64(1.0 / Float64(Float64(x_m * -0.5) / y_m))))); else tmp = 1.0; end return tmp end
x_m = abs(x); y_m = abs(y); function tmp_2 = code(x_m, y_m) tmp = 0.0; if ((x_m / (y_m * 2.0)) <= 2e+194) tmp = 1.0 / cos((1.0 / (1.0 / ((x_m * -0.5) / y_m)))); else tmp = 1.0; end tmp_2 = 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], 2e+194], N[(1.0 / N[Cos[N[(1.0 / N[(1.0 / N[(N[(x$95$m * -0.5), $MachinePrecision] / y$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\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 \cdot 10^{+194}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{1}{\frac{1}{\frac{x\_m \cdot -0.5}{y\_m}}}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 1.99999999999999989e194Initial program 50.7%
remove-double-neg50.7%
distribute-frac-neg50.7%
tan-neg50.7%
distribute-frac-neg250.7%
distribute-lft-neg-out50.7%
distribute-frac-neg250.7%
distribute-lft-neg-out50.7%
distribute-frac-neg250.7%
distribute-frac-neg50.7%
neg-mul-150.7%
*-commutative50.7%
associate-/l*50.3%
*-commutative50.3%
associate-/r*50.4%
metadata-eval50.4%
sin-neg50.4%
distribute-frac-neg50.4%
Simplified51.1%
Taylor expanded in x around inf 62.2%
associate-*r/62.2%
*-commutative62.2%
associate-*r/62.1%
Simplified62.1%
associate-*r/62.2%
clear-num62.3%
Applied egg-rr62.3%
clear-num62.2%
add-sqr-sqrt32.1%
associate-/l/32.0%
div-inv31.9%
associate-/l*31.8%
associate-*l*31.9%
pow1/231.9%
pow-flip32.1%
metadata-eval32.1%
Applied egg-rr32.1%
associate-*r*32.1%
metadata-eval32.1%
pow-flip31.8%
pow1/231.8%
div-inv32.0%
clear-num32.2%
clear-num32.2%
*-commutative32.2%
associate-*l/32.0%
metadata-eval32.0%
distribute-lft-neg-in32.0%
*-commutative32.0%
associate-/l/32.2%
distribute-rgt-neg-in32.2%
metadata-eval32.2%
add-sqr-sqrt62.4%
Applied egg-rr62.4%
if 1.99999999999999989e194 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 2.8%
remove-double-neg2.8%
distribute-frac-neg2.8%
tan-neg2.8%
distribute-frac-neg22.8%
distribute-lft-neg-out2.8%
distribute-frac-neg22.8%
distribute-lft-neg-out2.8%
distribute-frac-neg22.8%
distribute-frac-neg2.8%
neg-mul-12.8%
*-commutative2.8%
associate-/l*3.0%
*-commutative3.0%
associate-/r*3.0%
metadata-eval3.0%
sin-neg3.0%
distribute-frac-neg3.0%
Simplified2.5%
Taylor expanded in x around 0 12.3%
Final simplification54.9%
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 43.6%
remove-double-neg43.6%
distribute-frac-neg43.6%
tan-neg43.6%
distribute-frac-neg243.6%
distribute-lft-neg-out43.6%
distribute-frac-neg243.6%
distribute-lft-neg-out43.6%
distribute-frac-neg243.6%
distribute-frac-neg43.6%
neg-mul-143.6%
*-commutative43.6%
associate-/l*43.3%
*-commutative43.3%
associate-/r*43.3%
metadata-eval43.3%
sin-neg43.3%
distribute-frac-neg43.3%
Simplified43.9%
add-sqr-sqrt22.5%
sqrt-unprod17.9%
pow217.9%
Applied egg-rr17.9%
Taylor expanded in x around 0 6.8%
Final simplification6.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 43.6%
remove-double-neg43.6%
distribute-frac-neg43.6%
tan-neg43.6%
distribute-frac-neg243.6%
distribute-lft-neg-out43.6%
distribute-frac-neg243.6%
distribute-lft-neg-out43.6%
distribute-frac-neg243.6%
distribute-frac-neg43.6%
neg-mul-143.6%
*-commutative43.6%
associate-/l*43.3%
*-commutative43.3%
associate-/r*43.3%
metadata-eval43.3%
sin-neg43.3%
distribute-frac-neg43.3%
Simplified43.9%
Taylor expanded in x around 0 54.1%
Final simplification54.1%
(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 2024080
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:precision binary64
:alt
(if (< y -1.2303690911306994e+114) 1.0 (if (< y -9.102852406811914e-222) (/ (sin (/ x (* y 2.0))) (* (sin (/ x (* y 2.0))) (log (exp (cos (/ x (* y 2.0))))))) 1.0))
(/ (tan (/ x (* y 2.0))) (sin (/ x (* y 2.0)))))