
(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 6 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}
y_m = (fabs.f64 y)
(FPCore (x y_m)
:precision binary64
(let* ((t_0 (/ x (* y_m 2.0))))
(if (<= (/ (tan t_0) (sin t_0)) 6.0)
(/ 1.0 (cos (* (/ (* x -0.5) (sqrt y_m)) (pow y_m -0.5))))
1.0)))y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = x / (y_m * 2.0);
double tmp;
if ((tan(t_0) / sin(t_0)) <= 6.0) {
tmp = 1.0 / cos((((x * -0.5) / sqrt(y_m)) * pow(y_m, -0.5)));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: tmp
t_0 = x / (y_m * 2.0d0)
if ((tan(t_0) / sin(t_0)) <= 6.0d0) then
tmp = 1.0d0 / cos((((x * (-0.5d0)) / sqrt(y_m)) * (y_m ** (-0.5d0))))
else
tmp = 1.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = x / (y_m * 2.0);
double tmp;
if ((Math.tan(t_0) / Math.sin(t_0)) <= 6.0) {
tmp = 1.0 / Math.cos((((x * -0.5) / Math.sqrt(y_m)) * Math.pow(y_m, -0.5)));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = x / (y_m * 2.0) tmp = 0 if (math.tan(t_0) / math.sin(t_0)) <= 6.0: tmp = 1.0 / math.cos((((x * -0.5) / math.sqrt(y_m)) * math.pow(y_m, -0.5))) else: tmp = 1.0 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(x / Float64(y_m * 2.0)) tmp = 0.0 if (Float64(tan(t_0) / sin(t_0)) <= 6.0) tmp = Float64(1.0 / cos(Float64(Float64(Float64(x * -0.5) / sqrt(y_m)) * (y_m ^ -0.5)))); else tmp = 1.0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = x / (y_m * 2.0); tmp = 0.0; if ((tan(t_0) / sin(t_0)) <= 6.0) tmp = 1.0 / cos((((x * -0.5) / sqrt(y_m)) * (y_m ^ -0.5))); else tmp = 1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(x / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision], 6.0], N[(1.0 / N[Cos[N[(N[(N[(x * -0.5), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] * N[Power[y$95$m, -0.5], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x}{y\_m \cdot 2}\\
\mathbf{if}\;\frac{\tan t\_0}{\sin t\_0} \leq 6:\\
\;\;\;\;\frac{1}{\cos \left(\frac{x \cdot -0.5}{\sqrt{y\_m}} \cdot {y\_m}^{-0.5}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) < 6Initial program 57.4%
remove-double-neg57.4%
distribute-frac-neg57.4%
tan-neg57.4%
distribute-frac-neg257.4%
distribute-lft-neg-out57.4%
distribute-frac-neg257.4%
distribute-lft-neg-out57.4%
distribute-frac-neg257.4%
distribute-frac-neg57.4%
neg-mul-157.4%
*-commutative57.4%
associate-/l*56.6%
*-commutative56.6%
associate-/r*56.6%
metadata-eval56.6%
sin-neg56.6%
distribute-frac-neg56.6%
Simplified57.1%
Taylor expanded in x around inf 57.4%
associate-*r/57.4%
*-commutative57.4%
associate-*r/57.1%
Simplified57.1%
associate-*r/57.4%
add-sqr-sqrt28.4%
associate-/r*28.3%
Applied egg-rr28.3%
div-inv28.3%
associate-/l*28.5%
pow1/228.5%
pow-flip28.3%
metadata-eval28.3%
Applied egg-rr28.3%
associate-*r/28.4%
Simplified28.4%
if 6 < (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) Initial program 0.3%
remove-double-neg0.3%
distribute-frac-neg0.3%
tan-neg0.3%
distribute-frac-neg20.3%
distribute-lft-neg-out0.3%
distribute-frac-neg20.3%
distribute-lft-neg-out0.3%
distribute-frac-neg20.3%
distribute-frac-neg0.3%
neg-mul-10.3%
*-commutative0.3%
associate-/l*0.3%
*-commutative0.3%
associate-/r*0.3%
metadata-eval0.3%
sin-neg0.3%
distribute-frac-neg0.3%
Simplified0.3%
Taylor expanded in x around 0 47.1%
Final simplification33.4%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (let* ((t_0 (/ x (* y_m 2.0))) (t_1 (/ (tan t_0) (sin t_0)))) (if (<= t_1 6.0) t_1 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
double t_0 = x / (y_m * 2.0);
double t_1 = tan(t_0) / sin(t_0);
double tmp;
if (t_1 <= 6.0) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y_m * 2.0d0)
t_1 = tan(t_0) / sin(t_0)
if (t_1 <= 6.0d0) then
tmp = t_1
else
tmp = 1.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double t_0 = x / (y_m * 2.0);
double t_1 = Math.tan(t_0) / Math.sin(t_0);
double tmp;
if (t_1 <= 6.0) {
tmp = t_1;
} else {
tmp = 1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): t_0 = x / (y_m * 2.0) t_1 = math.tan(t_0) / math.sin(t_0) tmp = 0 if t_1 <= 6.0: tmp = t_1 else: tmp = 1.0 return tmp
y_m = abs(y) function code(x, y_m) t_0 = Float64(x / Float64(y_m * 2.0)) t_1 = Float64(tan(t_0) / sin(t_0)) tmp = 0.0 if (t_1 <= 6.0) tmp = t_1; else tmp = 1.0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) t_0 = x / (y_m * 2.0); t_1 = tan(t_0) / sin(t_0); tmp = 0.0; if (t_1 <= 6.0) tmp = t_1; else tmp = 1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(x / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[t$95$0], $MachinePrecision] / N[Sin[t$95$0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 6.0], t$95$1, 1.0]]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
t_0 := \frac{x}{y\_m \cdot 2}\\
t_1 := \frac{\tan t\_0}{\sin t\_0}\\
\mathbf{if}\;t\_1 \leq 6:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) < 6Initial program 57.4%
if 6 < (/.f64 (tan.f64 (/.f64 x (*.f64 y #s(literal 2 binary64)))) (sin.f64 (/.f64 x (*.f64 y #s(literal 2 binary64))))) Initial program 0.3%
remove-double-neg0.3%
distribute-frac-neg0.3%
tan-neg0.3%
distribute-frac-neg20.3%
distribute-lft-neg-out0.3%
distribute-frac-neg20.3%
distribute-lft-neg-out0.3%
distribute-frac-neg20.3%
distribute-frac-neg0.3%
neg-mul-10.3%
*-commutative0.3%
associate-/l*0.3%
*-commutative0.3%
associate-/r*0.3%
metadata-eval0.3%
sin-neg0.3%
distribute-frac-neg0.3%
Simplified0.3%
Taylor expanded in x around 0 47.1%
Final simplification54.6%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (/ x (* y_m 2.0)) 1e+268) (/ 1.0 (cos (/ (/ (* x -0.5) (sqrt y_m)) (sqrt y_m)))) 1.0))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((x / (y_m * 2.0)) <= 1e+268) {
tmp = 1.0 / cos((((x * -0.5) / sqrt(y_m)) / sqrt(y_m)));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if ((x / (y_m * 2.0d0)) <= 1d+268) then
tmp = 1.0d0 / cos((((x * (-0.5d0)) / sqrt(y_m)) / sqrt(y_m)))
else
tmp = 1.0d0
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if ((x / (y_m * 2.0)) <= 1e+268) {
tmp = 1.0 / Math.cos((((x * -0.5) / Math.sqrt(y_m)) / Math.sqrt(y_m)));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if (x / (y_m * 2.0)) <= 1e+268: tmp = 1.0 / math.cos((((x * -0.5) / math.sqrt(y_m)) / math.sqrt(y_m))) else: tmp = 1.0 return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(x / Float64(y_m * 2.0)) <= 1e+268) tmp = Float64(1.0 / cos(Float64(Float64(Float64(x * -0.5) / sqrt(y_m)) / sqrt(y_m)))); else tmp = 1.0; end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if ((x / (y_m * 2.0)) <= 1e+268) tmp = 1.0 / cos((((x * -0.5) / sqrt(y_m)) / sqrt(y_m))); else tmp = 1.0; end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(x / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 1e+268], N[(1.0 / N[Cos[N[(N[(N[(x * -0.5), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision] / N[Sqrt[y$95$m], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y\_m \cdot 2} \leq 10^{+268}:\\
\;\;\;\;\frac{1}{\cos \left(\frac{\frac{x \cdot -0.5}{\sqrt{y\_m}}}{\sqrt{y\_m}}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (/.f64 x (*.f64 y #s(literal 2 binary64))) < 9.9999999999999997e267Initial program 47.0%
remove-double-neg47.0%
distribute-frac-neg47.0%
tan-neg47.0%
distribute-frac-neg247.0%
distribute-lft-neg-out47.0%
distribute-frac-neg247.0%
distribute-lft-neg-out47.0%
distribute-frac-neg247.0%
distribute-frac-neg47.0%
neg-mul-147.0%
*-commutative47.0%
associate-/l*46.3%
*-commutative46.3%
associate-/r*46.3%
metadata-eval46.3%
sin-neg46.3%
distribute-frac-neg46.3%
Simplified46.7%
Taylor expanded in x around inf 58.8%
associate-*r/58.8%
*-commutative58.8%
associate-*r/58.5%
Simplified58.5%
associate-*r/58.8%
add-sqr-sqrt28.0%
associate-/r*28.0%
Applied egg-rr28.0%
if 9.9999999999999997e267 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 1.7%
remove-double-neg1.7%
distribute-frac-neg1.7%
tan-neg1.7%
distribute-frac-neg21.7%
distribute-lft-neg-out1.7%
distribute-frac-neg21.7%
distribute-lft-neg-out1.7%
distribute-frac-neg21.7%
distribute-frac-neg1.7%
neg-mul-11.7%
*-commutative1.7%
associate-/l*1.6%
*-commutative1.6%
associate-/r*1.6%
metadata-eval1.6%
sin-neg1.6%
distribute-frac-neg1.6%
Simplified1.7%
Taylor expanded in x around 0 9.5%
Final simplification25.9%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= (/ x (* y_m 2.0)) 2e+68) (/ 1.0 (cos (pow (cbrt (* x (/ -0.5 y_m))) 3.0))) 1.0))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if ((x / (y_m * 2.0)) <= 2e+68) {
tmp = 1.0 / cos(pow(cbrt((x * (-0.5 / y_m))), 3.0));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if ((x / (y_m * 2.0)) <= 2e+68) {
tmp = 1.0 / Math.cos(Math.pow(Math.cbrt((x * (-0.5 / y_m))), 3.0));
} else {
tmp = 1.0;
}
return tmp;
}
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (Float64(x / Float64(y_m * 2.0)) <= 2e+68) tmp = Float64(1.0 / cos((cbrt(Float64(x * Float64(-0.5 / y_m))) ^ 3.0))); else tmp = 1.0; end return tmp end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[N[(x / N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision], 2e+68], N[(1.0 / N[Cos[N[Power[N[Power[N[(x * N[(-0.5 / y$95$m), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y\_m \cdot 2} \leq 2 \cdot 10^{+68}:\\
\;\;\;\;\frac{1}{\cos \left({\left(\sqrt[3]{x \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))) < 1.99999999999999991e68Initial 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%
Simplified50.8%
Taylor expanded in x around inf 64.5%
associate-*r/64.5%
*-commutative64.5%
associate-*r/64.2%
Simplified64.2%
add-cube-cbrt63.8%
pow364.1%
Applied egg-rr64.1%
if 1.99999999999999991e68 < (/.f64 x (*.f64 y #s(literal 2 binary64))) Initial program 8.0%
remove-double-neg8.0%
distribute-frac-neg8.0%
tan-neg8.0%
distribute-frac-neg28.0%
distribute-lft-neg-out8.0%
distribute-frac-neg28.0%
distribute-lft-neg-out8.0%
distribute-frac-neg28.0%
distribute-frac-neg8.0%
neg-mul-18.0%
*-commutative8.0%
associate-/l*6.9%
*-commutative6.9%
associate-/r*6.9%
metadata-eval6.9%
sin-neg6.9%
distribute-frac-neg6.9%
Simplified7.8%
Taylor expanded in x around 0 9.6%
Final simplification52.6%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 (if (<= y_m 3.2e-142) 1.0 (/ 1.0 (cos (* 0.5 (/ x y_m))))))
y_m = fabs(y);
double code(double x, double y_m) {
double tmp;
if (y_m <= 3.2e-142) {
tmp = 1.0;
} else {
tmp = 1.0 / cos((0.5 * (x / y_m)));
}
return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
real(8) :: tmp
if (y_m <= 3.2d-142) then
tmp = 1.0d0
else
tmp = 1.0d0 / cos((0.5d0 * (x / y_m)))
end if
code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
double tmp;
if (y_m <= 3.2e-142) {
tmp = 1.0;
} else {
tmp = 1.0 / Math.cos((0.5 * (x / y_m)));
}
return tmp;
}
y_m = math.fabs(y) def code(x, y_m): tmp = 0 if y_m <= 3.2e-142: tmp = 1.0 else: tmp = 1.0 / math.cos((0.5 * (x / y_m))) return tmp
y_m = abs(y) function code(x, y_m) tmp = 0.0 if (y_m <= 3.2e-142) tmp = 1.0; else tmp = Float64(1.0 / cos(Float64(0.5 * Float64(x / y_m)))); end return tmp end
y_m = abs(y); function tmp_2 = code(x, y_m) tmp = 0.0; if (y_m <= 3.2e-142) tmp = 1.0; else tmp = 1.0 / cos((0.5 * (x / y_m))); end tmp_2 = tmp; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := If[LessEqual[y$95$m, 3.2e-142], 1.0, N[(1.0 / N[Cos[N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|
\\
\begin{array}{l}
\mathbf{if}\;y\_m \leq 3.2 \cdot 10^{-142}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\cos \left(0.5 \cdot \frac{x}{y\_m}\right)}\\
\end{array}
\end{array}
if y < 3.1999999999999998e-142Initial program 35.6%
remove-double-neg35.6%
distribute-frac-neg35.6%
tan-neg35.6%
distribute-frac-neg235.6%
distribute-lft-neg-out35.6%
distribute-frac-neg235.6%
distribute-lft-neg-out35.6%
distribute-frac-neg235.6%
distribute-frac-neg35.6%
neg-mul-135.6%
*-commutative35.6%
associate-/l*35.1%
*-commutative35.1%
associate-/r*35.1%
metadata-eval35.1%
sin-neg35.1%
distribute-frac-neg35.1%
Simplified35.7%
Taylor expanded in x around 0 46.6%
if 3.1999999999999998e-142 < y Initial program 52.7%
Taylor expanded in x around inf 64.2%
Final simplification53.2%
y_m = (fabs.f64 y) (FPCore (x y_m) :precision binary64 1.0)
y_m = fabs(y);
double code(double x, double y_m) {
return 1.0;
}
y_m = abs(y)
real(8) function code(x, y_m)
real(8), intent (in) :: x
real(8), intent (in) :: y_m
code = 1.0d0
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
return 1.0;
}
y_m = math.fabs(y) def code(x, y_m): return 1.0
y_m = abs(y) function code(x, y_m) return 1.0 end
y_m = abs(y); function tmp = code(x, y_m) tmp = 1.0; end
y_m = N[Abs[y], $MachinePrecision] code[x_, y$95$m_] := 1.0
\begin{array}{l}
y_m = \left|y\right|
\\
1
\end{array}
Initial program 42.0%
remove-double-neg42.0%
distribute-frac-neg42.0%
tan-neg42.0%
distribute-frac-neg242.0%
distribute-lft-neg-out42.0%
distribute-frac-neg242.0%
distribute-lft-neg-out42.0%
distribute-frac-neg242.0%
distribute-frac-neg42.0%
neg-mul-142.0%
*-commutative42.0%
associate-/l*41.4%
*-commutative41.4%
associate-/r*41.4%
metadata-eval41.4%
sin-neg41.4%
distribute-frac-neg41.4%
Simplified41.8%
Taylor expanded in x around 0 52.2%
Final simplification52.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (* y 2.0))) (t_1 (sin t_0)))
(if (< y -1.2303690911306994e+114)
1.0
(if (< y -9.102852406811914e-222)
(/ t_1 (* t_1 (log (exp (cos t_0)))))
1.0))))
double code(double x, double y) {
double t_0 = x / (y * 2.0);
double t_1 = sin(t_0);
double tmp;
if (y < -1.2303690911306994e+114) {
tmp = 1.0;
} else if (y < -9.102852406811914e-222) {
tmp = t_1 / (t_1 * log(exp(cos(t_0))));
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y * 2.0d0)
t_1 = sin(t_0)
if (y < (-1.2303690911306994d+114)) then
tmp = 1.0d0
else if (y < (-9.102852406811914d-222)) then
tmp = t_1 / (t_1 * log(exp(cos(t_0))))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y * 2.0);
double t_1 = Math.sin(t_0);
double tmp;
if (y < -1.2303690911306994e+114) {
tmp = 1.0;
} else if (y < -9.102852406811914e-222) {
tmp = t_1 / (t_1 * Math.log(Math.exp(Math.cos(t_0))));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): t_0 = x / (y * 2.0) t_1 = math.sin(t_0) tmp = 0 if y < -1.2303690911306994e+114: tmp = 1.0 elif y < -9.102852406811914e-222: tmp = t_1 / (t_1 * math.log(math.exp(math.cos(t_0)))) else: tmp = 1.0 return tmp
function code(x, y) t_0 = Float64(x / Float64(y * 2.0)) t_1 = sin(t_0) tmp = 0.0 if (y < -1.2303690911306994e+114) tmp = 1.0; elseif (y < -9.102852406811914e-222) tmp = Float64(t_1 / Float64(t_1 * log(exp(cos(t_0))))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y * 2.0); t_1 = sin(t_0); tmp = 0.0; if (y < -1.2303690911306994e+114) tmp = 1.0; elseif (y < -9.102852406811914e-222) tmp = t_1 / (t_1 * log(exp(cos(t_0)))); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[t$95$0], $MachinePrecision]}, If[Less[y, -1.2303690911306994e+114], 1.0, If[Less[y, -9.102852406811914e-222], N[(t$95$1 / N[(t$95$1 * N[Log[N[Exp[N[Cos[t$95$0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{y \cdot 2}\\
t_1 := \sin t\_0\\
\mathbf{if}\;y < -1.2303690911306994 \cdot 10^{+114}:\\
\;\;\;\;1\\
\mathbf{elif}\;y < -9.102852406811914 \cdot 10^{-222}:\\
\;\;\;\;\frac{t\_1}{t\_1 \cdot \log \left(e^{\cos t\_0}\right)}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
herbie shell --seed 2024095
(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)))))