
(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}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(let* ((t_0 (pow (sqrt (/ (* x 0.5) y)) 3.0)))
(if (<= (/ x (* y 2.0)) 1e+85)
(pow (/ 1.0 (cbrt (cos (cbrt (* t_0 t_0))))) 3.0)
1.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double t_0 = pow(sqrt(((x * 0.5) / y)), 3.0);
double tmp;
if ((x / (y * 2.0)) <= 1e+85) {
tmp = pow((1.0 / cbrt(cos(cbrt((t_0 * t_0))))), 3.0);
} else {
tmp = 1.0;
}
return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double t_0 = Math.pow(Math.sqrt(((x * 0.5) / y)), 3.0);
double tmp;
if ((x / (y * 2.0)) <= 1e+85) {
tmp = Math.pow((1.0 / Math.cbrt(Math.cos(Math.cbrt((t_0 * t_0))))), 3.0);
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) t_0 = sqrt(Float64(Float64(x * 0.5) / y)) ^ 3.0 tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 1e+85) tmp = Float64(1.0 / cbrt(cos(cbrt(Float64(t_0 * t_0))))) ^ 3.0; else tmp = 1.0; end return tmp end
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
code[x_, y_] := Block[{t$95$0 = N[Power[N[Sqrt[N[(N[(x * 0.5), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision]}, If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 1e+85], N[Power[N[(1.0 / N[Power[N[Cos[N[Power[N[(t$95$0 * t$95$0), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], 1.0]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
t_0 := {\left(\sqrt{\frac{x \cdot 0.5}{y}}\right)}^{3}\\
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 10^{+85}:\\
\;\;\;\;{\left(\frac{1}{\sqrt[3]{\cos \left(\sqrt[3]{t_0 \cdot t_0}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 1e85Initial program 51.8%
add-cube-cbrt51.7%
pow351.7%
Applied egg-rr59.7%
clear-num59.7%
div-inv59.7%
metadata-eval59.7%
div-inv60.1%
*-un-lft-identity60.1%
*-commutative60.1%
times-frac60.1%
metadata-eval60.1%
add-sqr-sqrt33.6%
pow233.6%
Applied egg-rr33.6%
clear-num33.7%
div-inv33.7%
associate-/r/33.7%
*-commutative33.7%
associate-*r/33.6%
sqrt-div11.9%
Applied egg-rr11.9%
unpow211.9%
add-cbrt-cube11.9%
add-cbrt-cube11.7%
cbrt-unprod12.2%
pow312.1%
sqrt-undiv11.8%
pow312.1%
sqrt-undiv34.2%
Applied egg-rr34.2%
if 1e85 < (/.f64 x (*.f64 y 2)) Initial program 6.0%
Taylor expanded in x around 0 13.9%
Final simplification31.0%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= (/ x (* y 2.0)) 1e+255)
(pow (/ 1.0 (cbrt (cos (pow (/ (sqrt (* x 0.5)) (sqrt y)) 2.0)))) 3.0)
(pow
(/ 1.0 (expm1 (+ (log 2.0) (* (* (/ x y) (/ x y)) -0.020833333333333332))))
3.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+255) {
tmp = pow((1.0 / cbrt(cos(pow((sqrt((x * 0.5)) / sqrt(y)), 2.0)))), 3.0);
} else {
tmp = pow((1.0 / expm1((log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+255) {
tmp = Math.pow((1.0 / Math.cbrt(Math.cos(Math.pow((Math.sqrt((x * 0.5)) / Math.sqrt(y)), 2.0)))), 3.0);
} else {
tmp = Math.pow((1.0 / Math.expm1((Math.log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 1e+255) tmp = Float64(1.0 / cbrt(cos((Float64(sqrt(Float64(x * 0.5)) / sqrt(y)) ^ 2.0)))) ^ 3.0; else tmp = Float64(1.0 / expm1(Float64(log(2.0) + Float64(Float64(Float64(x / y) * Float64(x / y)) * -0.020833333333333332)))) ^ 3.0; end return tmp end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 1e+255], N[Power[N[(1.0 / N[Power[N[Cos[N[Power[N[(N[Sqrt[N[(x * 0.5), $MachinePrecision]], $MachinePrecision] / N[Sqrt[y], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[Power[N[(1.0 / N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 10^{+255}:\\
\;\;\;\;{\left(\frac{1}{\sqrt[3]{\cos \left({\left(\frac{\sqrt{x \cdot 0.5}}{\sqrt{y}}\right)}^{2}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\mathsf{expm1}\left(\log 2 + \left(\frac{x}{y} \cdot \frac{x}{y}\right) \cdot -0.020833333333333332\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 9.99999999999999988e254Initial program 47.6%
add-cube-cbrt47.6%
pow347.6%
Applied egg-rr54.8%
clear-num54.8%
div-inv54.8%
metadata-eval54.8%
div-inv55.1%
*-un-lft-identity55.1%
*-commutative55.1%
times-frac55.1%
metadata-eval55.1%
add-sqr-sqrt31.4%
pow231.4%
Applied egg-rr31.4%
clear-num31.5%
div-inv31.5%
associate-/r/31.4%
*-commutative31.4%
associate-*r/31.4%
sqrt-div11.2%
Applied egg-rr11.2%
if 9.99999999999999988e254 < (/.f64 x (*.f64 y 2)) Initial program 2.5%
add-cube-cbrt2.5%
pow32.5%
Applied egg-rr2.5%
clear-num2.5%
div-inv2.5%
metadata-eval2.5%
div-inv2.5%
*-un-lft-identity2.5%
*-commutative2.5%
times-frac2.5%
metadata-eval2.5%
expm1-log1p-u2.5%
Applied egg-rr2.5%
Taylor expanded in x around 0 8.2%
*-commutative8.2%
unpow28.2%
unpow28.2%
times-frac8.2%
Simplified8.2%
Final simplification11.0%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= (/ x (* y 2.0)) 5e+255)
(pow (/ 1.0 (cbrt (cos (* (* x 0.5) (pow (pow y -0.5) 2.0))))) 3.0)
(pow
(/ 1.0 (expm1 (+ (log 2.0) (* (* (/ x y) (/ x y)) -0.020833333333333332))))
3.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = pow((1.0 / cbrt(cos(((x * 0.5) * pow(pow(y, -0.5), 2.0))))), 3.0);
} else {
tmp = pow((1.0 / expm1((log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = Math.pow((1.0 / Math.cbrt(Math.cos(((x * 0.5) * Math.pow(Math.pow(y, -0.5), 2.0))))), 3.0);
} else {
tmp = Math.pow((1.0 / Math.expm1((Math.log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 5e+255) tmp = Float64(1.0 / cbrt(cos(Float64(Float64(x * 0.5) * ((y ^ -0.5) ^ 2.0))))) ^ 3.0; else tmp = Float64(1.0 / expm1(Float64(log(2.0) + Float64(Float64(Float64(x / y) * Float64(x / y)) * -0.020833333333333332)))) ^ 3.0; end return tmp end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 5e+255], N[Power[N[(1.0 / N[Power[N[Cos[N[(N[(x * 0.5), $MachinePrecision] * N[Power[N[Power[y, -0.5], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[Power[N[(1.0 / N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 5 \cdot 10^{+255}:\\
\;\;\;\;{\left(\frac{1}{\sqrt[3]{\cos \left(\left(x \cdot 0.5\right) \cdot {\left({y}^{-0.5}\right)}^{2}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\mathsf{expm1}\left(\log 2 + \left(\frac{x}{y} \cdot \frac{x}{y}\right) \cdot -0.020833333333333332\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 5.0000000000000002e255Initial program 47.5%
add-cube-cbrt47.5%
pow347.5%
Applied egg-rr54.7%
clear-num54.7%
div-inv54.7%
metadata-eval54.7%
div-inv55.0%
*-un-lft-identity55.0%
*-commutative55.0%
times-frac55.0%
metadata-eval55.0%
add-sqr-sqrt31.3%
pow231.3%
Applied egg-rr31.3%
clear-num31.5%
div-inv31.5%
associate-/r/31.3%
*-commutative31.3%
associate-*r/31.3%
sqrt-div11.2%
Applied egg-rr11.2%
div-inv11.2%
unpow-prod-down11.2%
pow211.2%
add-sqr-sqrt25.4%
pow1/225.4%
pow-flip25.3%
metadata-eval25.3%
Applied egg-rr25.3%
if 5.0000000000000002e255 < (/.f64 x (*.f64 y 2)) Initial program 1.0%
add-cube-cbrt1.0%
pow31.0%
Applied egg-rr1.0%
clear-num1.0%
div-inv1.0%
metadata-eval1.0%
div-inv1.0%
*-un-lft-identity1.0%
*-commutative1.0%
times-frac1.0%
metadata-eval1.0%
expm1-log1p-u1.0%
Applied egg-rr1.0%
Taylor expanded in x around 0 8.6%
*-commutative8.6%
unpow28.6%
unpow28.6%
times-frac8.6%
Simplified8.6%
Final simplification24.3%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= (/ x (* y 2.0)) 5e+255)
(pow (/ 1.0 (cbrt (cos (pow (sqrt (* 0.5 (/ x y))) 2.0)))) 3.0)
(pow
(/ 1.0 (expm1 (+ (log 2.0) (* (* (/ x y) (/ x y)) -0.020833333333333332))))
3.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = pow((1.0 / cbrt(cos(pow(sqrt((0.5 * (x / y))), 2.0)))), 3.0);
} else {
tmp = pow((1.0 / expm1((log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = Math.pow((1.0 / Math.cbrt(Math.cos(Math.pow(Math.sqrt((0.5 * (x / y))), 2.0)))), 3.0);
} else {
tmp = Math.pow((1.0 / Math.expm1((Math.log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 5e+255) tmp = Float64(1.0 / cbrt(cos((sqrt(Float64(0.5 * Float64(x / y))) ^ 2.0)))) ^ 3.0; else tmp = Float64(1.0 / expm1(Float64(log(2.0) + Float64(Float64(Float64(x / y) * Float64(x / y)) * -0.020833333333333332)))) ^ 3.0; end return tmp end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 5e+255], N[Power[N[(1.0 / N[Power[N[Cos[N[Power[N[Sqrt[N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[Power[N[(1.0 / N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 5 \cdot 10^{+255}:\\
\;\;\;\;{\left(\frac{1}{\sqrt[3]{\cos \left({\left(\sqrt{0.5 \cdot \frac{x}{y}}\right)}^{2}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\mathsf{expm1}\left(\log 2 + \left(\frac{x}{y} \cdot \frac{x}{y}\right) \cdot -0.020833333333333332\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 5.0000000000000002e255Initial program 47.5%
add-cube-cbrt47.5%
pow347.5%
Applied egg-rr54.7%
clear-num54.7%
div-inv54.7%
metadata-eval54.7%
div-inv55.0%
*-un-lft-identity55.0%
*-commutative55.0%
times-frac55.0%
metadata-eval55.0%
add-sqr-sqrt31.3%
pow231.3%
Applied egg-rr31.3%
if 5.0000000000000002e255 < (/.f64 x (*.f64 y 2)) Initial program 1.0%
add-cube-cbrt1.0%
pow31.0%
Applied egg-rr1.0%
clear-num1.0%
div-inv1.0%
metadata-eval1.0%
div-inv1.0%
*-un-lft-identity1.0%
*-commutative1.0%
times-frac1.0%
metadata-eval1.0%
expm1-log1p-u1.0%
Applied egg-rr1.0%
Taylor expanded in x around 0 8.6%
*-commutative8.6%
unpow28.6%
unpow28.6%
times-frac8.6%
Simplified8.6%
Final simplification29.9%
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= (/ x (* y 2.0)) 5e+255)
(pow (/ 1.0 (cbrt (cos (/ 0.5 (/ y x))))) 3.0)
(pow
(/ 1.0 (expm1 (+ (log 2.0) (* (* (/ x y) (/ x y)) -0.020833333333333332))))
3.0)))x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = pow((1.0 / cbrt(cos((0.5 / (y / x))))), 3.0);
} else {
tmp = pow((1.0 / expm1((log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 5e+255) {
tmp = Math.pow((1.0 / Math.cbrt(Math.cos((0.5 / (y / x))))), 3.0);
} else {
tmp = Math.pow((1.0 / Math.expm1((Math.log(2.0) + (((x / y) * (x / y)) * -0.020833333333333332)))), 3.0);
}
return tmp;
}
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 5e+255) tmp = Float64(1.0 / cbrt(cos(Float64(0.5 / Float64(y / x))))) ^ 3.0; else tmp = Float64(1.0 / expm1(Float64(log(2.0) + Float64(Float64(Float64(x / y) * Float64(x / y)) * -0.020833333333333332)))) ^ 3.0; end return tmp end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 5e+255], N[Power[N[(1.0 / N[Power[N[Cos[N[(0.5 / N[(y / x), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision], N[Power[N[(1.0 / N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(N[(N[(x / y), $MachinePrecision] * N[(x / y), $MachinePrecision]), $MachinePrecision] * -0.020833333333333332), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision], 3.0], $MachinePrecision]]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 5 \cdot 10^{+255}:\\
\;\;\;\;{\left(\frac{1}{\sqrt[3]{\cos \left(\frac{0.5}{\frac{y}{x}}\right)}}\right)}^{3}\\
\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\mathsf{expm1}\left(\log 2 + \left(\frac{x}{y} \cdot \frac{x}{y}\right) \cdot -0.020833333333333332\right)}\right)}^{3}\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 5.0000000000000002e255Initial program 47.5%
add-cube-cbrt47.5%
pow347.5%
Applied egg-rr54.7%
clear-num54.7%
div-inv54.7%
metadata-eval54.7%
div-inv55.0%
*-un-lft-identity55.0%
*-commutative55.0%
times-frac55.0%
metadata-eval55.0%
clear-num55.2%
un-div-inv55.2%
Applied egg-rr55.2%
if 5.0000000000000002e255 < (/.f64 x (*.f64 y 2)) Initial program 1.0%
add-cube-cbrt1.0%
pow31.0%
Applied egg-rr1.0%
clear-num1.0%
div-inv1.0%
metadata-eval1.0%
div-inv1.0%
*-un-lft-identity1.0%
*-commutative1.0%
times-frac1.0%
metadata-eval1.0%
expm1-log1p-u1.0%
Applied egg-rr1.0%
Taylor expanded in x around 0 8.6%
*-commutative8.6%
unpow28.6%
unpow28.6%
times-frac8.6%
Simplified8.6%
Final simplification52.3%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= (/ x (* y 2.0)) 1e+36) (/ 1.0 (log (exp (cos (* 0.5 (/ x y)))))) 1.0))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+36) {
tmp = 1.0 / log(exp(cos((0.5 * (x / y)))));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x / (y * 2.0d0)) <= 1d+36) then
tmp = 1.0d0 / log(exp(cos((0.5d0 * (x / y)))))
else
tmp = 1.0d0
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+36) {
tmp = 1.0 / Math.log(Math.exp(Math.cos((0.5 * (x / y)))));
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): tmp = 0 if (x / (y * 2.0)) <= 1e+36: tmp = 1.0 / math.log(math.exp(math.cos((0.5 * (x / y))))) else: tmp = 1.0 return tmp
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 1e+36) tmp = Float64(1.0 / log(exp(cos(Float64(0.5 * Float64(x / y)))))); else tmp = 1.0; end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if ((x / (y * 2.0)) <= 1e+36) tmp = 1.0 / log(exp(cos((0.5 * (x / y))))); else tmp = 1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 1e+36], N[(1.0 / N[Log[N[Exp[N[Cos[N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 10^{+36}:\\
\;\;\;\;\frac{1}{\log \left(e^{\cos \left(0.5 \cdot \frac{x}{y}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 1.00000000000000004e36Initial program 56.1%
Taylor expanded in x around inf 65.2%
add-log-exp65.2%
Applied egg-rr65.2%
if 1.00000000000000004e36 < (/.f64 x (*.f64 y 2)) Initial program 6.4%
Taylor expanded in x around 0 12.5%
Final simplification53.1%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= (/ x (* y 2.0)) 1e+36) (/ 1.0 (cos (* 0.5 (/ x y)))) 1.0))
x = abs(x);
y = abs(y);
double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+36) {
tmp = 1.0 / cos((0.5 * (x / y)));
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x / (y * 2.0d0)) <= 1d+36) then
tmp = 1.0d0 / cos((0.5d0 * (x / y)))
else
tmp = 1.0d0
end if
code = tmp
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((x / (y * 2.0)) <= 1e+36) {
tmp = 1.0 / Math.cos((0.5 * (x / y)));
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) y = abs(y) def code(x, y): tmp = 0 if (x / (y * 2.0)) <= 1e+36: tmp = 1.0 / math.cos((0.5 * (x / y))) else: tmp = 1.0 return tmp
x = abs(x) y = abs(y) function code(x, y) tmp = 0.0 if (Float64(x / Float64(y * 2.0)) <= 1e+36) tmp = Float64(1.0 / cos(Float64(0.5 * Float64(x / y)))); else tmp = 1.0; end return tmp end
x = abs(x) y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if ((x / (y * 2.0)) <= 1e+36) tmp = 1.0 / cos((0.5 * (x / y))); else tmp = 1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision], 1e+36], N[(1.0 / N[Cos[N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y \cdot 2} \leq 10^{+36}:\\
\;\;\;\;\frac{1}{\cos \left(0.5 \cdot \frac{x}{y}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y 2)) < 1.00000000000000004e36Initial program 56.1%
Taylor expanded in x around inf 65.2%
if 1.00000000000000004e36 < (/.f64 x (*.f64 y 2)) Initial program 6.4%
Taylor expanded in x around 0 12.5%
Final simplification53.1%
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 1.0)
x = abs(x);
y = abs(y);
double code(double x, double y) {
return 1.0;
}
NOTE: x should be positive before calling this function
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
x = Math.abs(x);
y = Math.abs(y);
public static double code(double x, double y) {
return 1.0;
}
x = abs(x) y = abs(y) def code(x, y): return 1.0
x = abs(x) y = abs(y) function code(x, y) return 1.0 end
x = abs(x) y = abs(y) function tmp = code(x, y) tmp = 1.0; end
NOTE: x should be positive before calling this function NOTE: y should be positive before calling this function code[x_, y_] := 1.0
\begin{array}{l}
x = |x|\\
y = |y|\\
\\
1
\end{array}
Initial program 44.6%
Taylor expanded in x around 0 51.7%
Final simplification51.7%
(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 2023293
(FPCore (x y)
:name "Diagrams.TwoD.Layout.CirclePacking:approxRadius from diagrams-contrib-1.3.0.5"
:precision binary64
:herbie-target
(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)))))