
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cos x) (pow (/ y (sinh y)) -1.0)))
double code(double x, double y) {
return cos(x) * pow((y / sinh(y)), -1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * ((y / sinh(y)) ** (-1.0d0))
end function
public static double code(double x, double y) {
return Math.cos(x) * Math.pow((y / Math.sinh(y)), -1.0);
}
def code(x, y): return math.cos(x) * math.pow((y / math.sinh(y)), -1.0)
function code(x, y) return Float64(cos(x) * (Float64(y / sinh(y)) ^ -1.0)) end
function tmp = code(x, y) tmp = cos(x) * ((y / sinh(y)) ^ -1.0); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[Power[N[(y / N[Sinh[y], $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot {\left(\frac{y}{\sinh y}\right)}^{-1}
\end{array}
Initial program 100.0%
clear-num100.0%
inv-pow100.0%
Applied egg-rr100.0%
Final simplification100.0%
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* y y) (* y (* y 0.027777777777777776))))
(t_1 (/ (+ -1.0 t_0) (fma y (* y 0.16666666666666666) -1.0)))
(t_2 (* 0.16666666666666666 (* y y)))
(t_3 (* -0.5 (* x x))))
(if (<= y 840.0)
(* (cos x) (+ 1.0 t_2))
(if (<= y 5.1e+76)
(* (/ (+ 1.0 (pow t_2 3.0)) (+ (- 1.0 t_2) t_0)) (+ 1.0 t_3))
(if (<= y 2e+108)
t_1
(if (<= y 2e+146)
(*
(/
(+ -1.0 (* 0.027777777777777776 (pow y 4.0)))
(+ 1.0 (* (* y y) -0.16666666666666666)))
(- -1.0 t_3))
(if (<= y 1.35e+154)
t_1
(* 0.16666666666666666 (* (cos x) (* y y))))))))))
double code(double x, double y) {
double t_0 = (y * y) * (y * (y * 0.027777777777777776));
double t_1 = (-1.0 + t_0) / fma(y, (y * 0.16666666666666666), -1.0);
double t_2 = 0.16666666666666666 * (y * y);
double t_3 = -0.5 * (x * x);
double tmp;
if (y <= 840.0) {
tmp = cos(x) * (1.0 + t_2);
} else if (y <= 5.1e+76) {
tmp = ((1.0 + pow(t_2, 3.0)) / ((1.0 - t_2) + t_0)) * (1.0 + t_3);
} else if (y <= 2e+108) {
tmp = t_1;
} else if (y <= 2e+146) {
tmp = ((-1.0 + (0.027777777777777776 * pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (-1.0 - t_3);
} else if (y <= 1.35e+154) {
tmp = t_1;
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(y * y) * Float64(y * Float64(y * 0.027777777777777776))) t_1 = Float64(Float64(-1.0 + t_0) / fma(y, Float64(y * 0.16666666666666666), -1.0)) t_2 = Float64(0.16666666666666666 * Float64(y * y)) t_3 = Float64(-0.5 * Float64(x * x)) tmp = 0.0 if (y <= 840.0) tmp = Float64(cos(x) * Float64(1.0 + t_2)); elseif (y <= 5.1e+76) tmp = Float64(Float64(Float64(1.0 + (t_2 ^ 3.0)) / Float64(Float64(1.0 - t_2) + t_0)) * Float64(1.0 + t_3)); elseif (y <= 2e+108) tmp = t_1; elseif (y <= 2e+146) tmp = Float64(Float64(Float64(-1.0 + Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))) * Float64(-1.0 - t_3)); elseif (y <= 1.35e+154) tmp = t_1; else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(-1.0 + t$95$0), $MachinePrecision] / N[(y * N[(y * 0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 840.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e+76], N[(N[(N[(1.0 + N[Power[t$95$2, 3.0], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 - t$95$2), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] * N[(1.0 + t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2e+108], t$95$1, If[LessEqual[y, 2e+146], N[(N[(N[(-1.0 + N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 - t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], t$95$1, N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot 0.027777777777777776\right)\right)\\
t_1 := \frac{-1 + t_0}{\mathsf{fma}\left(y, y \cdot 0.16666666666666666, -1\right)}\\
t_2 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
t_3 := -0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x \cdot \left(1 + t_2\right)\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+76}:\\
\;\;\;\;\frac{1 + {t_2}^{3}}{\left(1 - t_2\right) + t_0} \cdot \left(1 + t_3\right)\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+108}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+146}:\\
\;\;\;\;\frac{-1 + 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666} \cdot \left(-1 - t_3\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
if 840 < y < 5.1000000000000002e76Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 22.3%
+-commutative22.3%
associate-+l+22.3%
*-commutative22.3%
associate-*l*22.3%
+-commutative22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
*-rgt-identity22.3%
distribute-lft-out22.3%
*-commutative22.3%
unpow222.3%
Simplified22.3%
fma-udef22.3%
flip3-+47.9%
metadata-eval47.9%
fma-def47.9%
metadata-eval47.9%
Applied egg-rr47.9%
+-commutative47.9%
*-commutative47.9%
associate-*r*47.9%
fma-udef47.9%
+-commutative47.9%
*-rgt-identity47.9%
*-commutative47.9%
associate-*r*47.9%
swap-sqr47.9%
swap-sqr47.9%
metadata-eval47.9%
associate-*r*47.9%
*-commutative47.9%
*-commutative47.9%
Simplified47.9%
if 5.1000000000000002e76 < y < 2.0000000000000001e108 or 1.99999999999999987e146 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 6.9%
unpow26.9%
Simplified6.9%
Taylor expanded in x around 0 6.9%
+-commutative6.9%
unpow26.9%
associate-*r*6.9%
*-commutative6.9%
fma-udef6.9%
Simplified6.9%
fma-udef6.9%
flip-+90.5%
metadata-eval90.5%
fma-neg90.5%
metadata-eval90.5%
fma-neg90.5%
metadata-eval90.5%
Applied egg-rr90.5%
fma-udef90.5%
+-commutative90.5%
swap-sqr90.5%
swap-sqr90.5%
metadata-eval90.5%
associate-*r*90.5%
*-commutative90.5%
*-commutative90.5%
Simplified90.5%
if 2.0000000000000001e108 < y < 1.99999999999999987e146Initial program 100.0%
Taylor expanded in y around 0 6.7%
unpow26.7%
Simplified6.7%
Taylor expanded in x around 0 32.5%
+-commutative32.5%
associate-+l+32.5%
*-commutative32.5%
associate-*l*32.5%
+-commutative32.5%
unpow232.5%
associate-*r*32.5%
*-commutative32.5%
fma-udef32.5%
unpow232.5%
associate-*r*32.5%
*-commutative32.5%
fma-udef32.5%
*-rgt-identity32.5%
distribute-lft-out32.5%
*-commutative32.5%
unpow232.5%
Simplified32.5%
fma-udef4.8%
flip-+71.4%
metadata-eval71.4%
fma-neg71.4%
metadata-eval71.4%
fma-neg71.4%
metadata-eval71.4%
Applied egg-rr85.7%
fma-udef71.4%
+-commutative71.4%
swap-sqr71.4%
swap-sqr71.4%
metadata-eval71.4%
associate-*r*71.4%
*-commutative71.4%
*-commutative71.4%
Simplified85.7%
frac-2neg85.7%
distribute-frac-neg85.7%
associate-*r*85.7%
associate-*r*85.7%
metadata-eval85.7%
swap-sqr85.7%
*-commutative85.7%
*-commutative85.7%
swap-sqr85.7%
metadata-eval85.7%
pow285.7%
pow285.7%
pow-prod-up85.7%
metadata-eval85.7%
fma-udef85.7%
*-commutative85.7%
associate-*r*85.7%
distribute-neg-in85.7%
Applied egg-rr85.7%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Final simplification85.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* -0.5 (* x x))) (t_1 (* 0.16666666666666666 (* y y))))
(if (<= y 840.0)
(* (cos x) (+ 1.0 t_1))
(if (<= y 5.1e+76)
(* t_1 (+ 1.0 t_0))
(if (<= y 1.05e+110)
(/
(+ -1.0 (* (* y y) (* y (* y 0.027777777777777776))))
(fma y (* y 0.16666666666666666) -1.0))
(if (<= y 1.35e+154)
(*
(/
(+ -1.0 (* 0.027777777777777776 (pow y 4.0)))
(+ 1.0 (* (* y y) -0.16666666666666666)))
(- -1.0 t_0))
(* 0.16666666666666666 (* (cos x) (* y y)))))))))
double code(double x, double y) {
double t_0 = -0.5 * (x * x);
double t_1 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = cos(x) * (1.0 + t_1);
} else if (y <= 5.1e+76) {
tmp = t_1 * (1.0 + t_0);
} else if (y <= 1.05e+110) {
tmp = (-1.0 + ((y * y) * (y * (y * 0.027777777777777776)))) / fma(y, (y * 0.16666666666666666), -1.0);
} else if (y <= 1.35e+154) {
tmp = ((-1.0 + (0.027777777777777776 * pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (-1.0 - t_0);
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
function code(x, y) t_0 = Float64(-0.5 * Float64(x * x)) t_1 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 840.0) tmp = Float64(cos(x) * Float64(1.0 + t_1)); elseif (y <= 5.1e+76) tmp = Float64(t_1 * Float64(1.0 + t_0)); elseif (y <= 1.05e+110) tmp = Float64(Float64(-1.0 + Float64(Float64(y * y) * Float64(y * Float64(y * 0.027777777777777776)))) / fma(y, Float64(y * 0.16666666666666666), -1.0)); elseif (y <= 1.35e+154) tmp = Float64(Float64(Float64(-1.0 + Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))) * Float64(-1.0 - t_0)); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 840.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e+76], N[(t$95$1 * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.05e+110], N[(N[(-1.0 + N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * N[(y * 0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(N[(-1.0 + N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -0.5 \cdot \left(x \cdot x\right)\\
t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x \cdot \left(1 + t_1\right)\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+76}:\\
\;\;\;\;t_1 \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 1.05 \cdot 10^{+110}:\\
\;\;\;\;\frac{-1 + \left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot 0.027777777777777776\right)\right)}{\mathsf{fma}\left(y, y \cdot 0.16666666666666666, -1\right)}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1 + 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666} \cdot \left(-1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
if 840 < y < 5.1000000000000002e76Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 22.3%
+-commutative22.3%
associate-+l+22.3%
*-commutative22.3%
associate-*l*22.3%
+-commutative22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
*-rgt-identity22.3%
distribute-lft-out22.3%
*-commutative22.3%
unpow222.3%
Simplified22.3%
Taylor expanded in y around inf 22.3%
unpow23.0%
Simplified22.3%
if 5.1000000000000002e76 < y < 1.05000000000000007e110Initial program 100.0%
Taylor expanded in y around 0 5.3%
unpow25.3%
Simplified5.3%
Taylor expanded in x around 0 5.3%
+-commutative5.3%
unpow25.3%
associate-*r*5.3%
*-commutative5.3%
fma-udef5.3%
Simplified5.3%
fma-udef5.3%
flip-+88.1%
metadata-eval88.1%
fma-neg88.1%
metadata-eval88.1%
fma-neg88.1%
metadata-eval88.1%
Applied egg-rr88.1%
fma-udef88.1%
+-commutative88.1%
swap-sqr88.1%
swap-sqr88.1%
metadata-eval88.1%
associate-*r*88.1%
*-commutative88.1%
*-commutative88.1%
Simplified88.1%
if 1.05000000000000007e110 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 8.2%
unpow28.2%
Simplified8.2%
Taylor expanded in x around 0 28.3%
+-commutative28.3%
associate-+l+28.3%
*-commutative28.3%
associate-*l*28.3%
+-commutative28.3%
unpow228.3%
associate-*r*28.3%
*-commutative28.3%
fma-udef28.3%
unpow228.3%
associate-*r*28.3%
*-commutative28.3%
fma-udef28.3%
*-rgt-identity28.3%
distribute-lft-out28.3%
*-commutative28.3%
unpow228.3%
Simplified28.3%
fma-udef6.8%
flip-+77.8%
metadata-eval77.8%
fma-neg77.8%
metadata-eval77.8%
fma-neg77.8%
metadata-eval77.8%
Applied egg-rr88.9%
fma-udef77.8%
+-commutative77.8%
swap-sqr77.8%
swap-sqr77.8%
metadata-eval77.8%
associate-*r*77.8%
*-commutative77.8%
*-commutative77.8%
Simplified88.9%
frac-2neg88.9%
distribute-frac-neg88.9%
associate-*r*88.9%
associate-*r*88.9%
metadata-eval88.9%
swap-sqr88.9%
*-commutative88.9%
*-commutative88.9%
swap-sqr88.9%
metadata-eval88.9%
pow288.9%
pow288.9%
pow-prod-up88.9%
metadata-eval88.9%
fma-udef88.9%
*-commutative88.9%
associate-*r*88.9%
distribute-neg-in88.9%
Applied egg-rr88.9%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Final simplification83.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 840.0)
(* (cos x) (+ 1.0 t_0))
(if (<= y 5.1e+76)
(* t_0 (+ 1.0 (* -0.5 (* x x))))
(if (<= y 1.35e+154)
(/
(+ -1.0 (* (* y y) (* y (* y 0.027777777777777776))))
(fma y (* y 0.16666666666666666) -1.0))
(* 0.16666666666666666 (* (cos x) (* y y))))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = cos(x) * (1.0 + t_0);
} else if (y <= 5.1e+76) {
tmp = t_0 * (1.0 + (-0.5 * (x * x)));
} else if (y <= 1.35e+154) {
tmp = (-1.0 + ((y * y) * (y * (y * 0.027777777777777776)))) / fma(y, (y * 0.16666666666666666), -1.0);
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 840.0) tmp = Float64(cos(x) * Float64(1.0 + t_0)); elseif (y <= 5.1e+76) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); elseif (y <= 1.35e+154) tmp = Float64(Float64(-1.0 + Float64(Float64(y * y) * Float64(y * Float64(y * 0.027777777777777776)))) / fma(y, Float64(y * 0.16666666666666666), -1.0)); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 840.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.1e+76], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(-1.0 + N[(N[(y * y), $MachinePrecision] * N[(y * N[(y * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y * N[(y * 0.16666666666666666), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 5.1 \cdot 10^{+76}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{-1 + \left(y \cdot y\right) \cdot \left(y \cdot \left(y \cdot 0.027777777777777776\right)\right)}{\mathsf{fma}\left(y, y \cdot 0.16666666666666666, -1\right)}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
if 840 < y < 5.1000000000000002e76Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 22.3%
+-commutative22.3%
associate-+l+22.3%
*-commutative22.3%
associate-*l*22.3%
+-commutative22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
unpow222.3%
associate-*r*22.3%
*-commutative22.3%
fma-udef22.3%
*-rgt-identity22.3%
distribute-lft-out22.3%
*-commutative22.3%
unpow222.3%
Simplified22.3%
Taylor expanded in y around inf 22.3%
unpow23.0%
Simplified22.3%
if 5.1000000000000002e76 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 6.8%
unpow26.8%
Simplified6.8%
Taylor expanded in x around 0 6.1%
+-commutative6.1%
unpow26.1%
associate-*r*6.1%
*-commutative6.1%
fma-udef6.1%
Simplified6.1%
fma-udef6.1%
flip-+82.6%
metadata-eval82.6%
fma-neg82.6%
metadata-eval82.6%
fma-neg82.6%
metadata-eval82.6%
Applied egg-rr82.6%
fma-udef82.6%
+-commutative82.6%
swap-sqr82.6%
swap-sqr82.6%
metadata-eval82.6%
associate-*r*82.6%
*-commutative82.6%
*-commutative82.6%
Simplified82.6%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
Simplified100.0%
Final simplification83.2%
(FPCore (x y)
:precision binary64
(if (<= y 840.0)
(cos x)
(if (<= y 1.6e+149)
(* (* 0.16666666666666666 (* y y)) (+ 1.0 (* -0.5 (* x x))))
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 840.0) {
tmp = cos(x);
} else if (y <= 1.6e+149) {
tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 840.0d0) then
tmp = cos(x)
else if (y <= 1.6d+149) then
tmp = (0.16666666666666666d0 * (y * y)) * (1.0d0 + ((-0.5d0) * (x * x)))
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 840.0) {
tmp = Math.cos(x);
} else if (y <= 1.6e+149) {
tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 840.0: tmp = math.cos(x) elif y <= 1.6e+149: tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x))) else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 840.0) tmp = cos(x); elseif (y <= 1.6e+149) tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 840.0) tmp = cos(x); elseif (y <= 1.6e+149) tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x))); else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 840.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.6e+149], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+149}:\\
\;\;\;\;\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
Taylor expanded in y around 0 69.2%
if 840 < y < 1.6000000000000001e149Initial program 100.0%
Taylor expanded in y around 0 4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in x around 0 19.3%
+-commutative19.3%
associate-+l+19.3%
*-commutative19.3%
associate-*l*19.3%
+-commutative19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
fma-udef19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
fma-udef19.3%
*-rgt-identity19.3%
distribute-lft-out19.3%
*-commutative19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in y around inf 19.3%
unpow24.1%
Simplified19.3%
if 1.6000000000000001e149 < y Initial program 100.0%
Taylor expanded in y around 0 95.5%
unpow295.5%
Simplified95.5%
Taylor expanded in y around inf 95.5%
unpow295.5%
Simplified95.5%
Final simplification67.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 840.0)
(* (cos x) (+ 1.0 t_0))
(if (<= y 1.6e+149)
(* t_0 (+ 1.0 (* -0.5 (* x x))))
(* 0.16666666666666666 (* (cos x) (* y y)))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = cos(x) * (1.0 + t_0);
} else if (y <= 1.6e+149) {
tmp = t_0 * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (y * y)
if (y <= 840.0d0) then
tmp = cos(x) * (1.0d0 + t_0)
else if (y <= 1.6d+149) then
tmp = t_0 * (1.0d0 + ((-0.5d0) * (x * x)))
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = Math.cos(x) * (1.0 + t_0);
} else if (y <= 1.6e+149) {
tmp = t_0 * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 840.0: tmp = math.cos(x) * (1.0 + t_0) elif y <= 1.6e+149: tmp = t_0 * (1.0 + (-0.5 * (x * x))) else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 840.0) tmp = Float64(cos(x) * Float64(1.0 + t_0)); elseif (y <= 1.6e+149) tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 840.0) tmp = cos(x) * (1.0 + t_0); elseif (y <= 1.6e+149) tmp = t_0 * (1.0 + (-0.5 * (x * x))); else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 840.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.6e+149], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{+149}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
if 840 < y < 1.6000000000000001e149Initial program 100.0%
Taylor expanded in y around 0 4.8%
unpow24.8%
Simplified4.8%
Taylor expanded in x around 0 19.3%
+-commutative19.3%
associate-+l+19.3%
*-commutative19.3%
associate-*l*19.3%
+-commutative19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
fma-udef19.3%
unpow219.3%
associate-*r*19.3%
*-commutative19.3%
fma-udef19.3%
*-rgt-identity19.3%
distribute-lft-out19.3%
*-commutative19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in y around inf 19.3%
unpow24.1%
Simplified19.3%
if 1.6000000000000001e149 < y Initial program 100.0%
Taylor expanded in y around 0 95.5%
unpow295.5%
Simplified95.5%
Taylor expanded in y around inf 95.5%
unpow295.5%
Simplified95.5%
Final simplification78.8%
(FPCore (x y) :precision binary64 (if (<= y 840.0) (cos x) (* (* 0.16666666666666666 (* y y)) (+ 1.0 (* -0.5 (* x x))))))
double code(double x, double y) {
double tmp;
if (y <= 840.0) {
tmp = cos(x);
} else {
tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 840.0d0) then
tmp = cos(x)
else
tmp = (0.16666666666666666d0 * (y * y)) * (1.0d0 + ((-0.5d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 840.0) {
tmp = Math.cos(x);
} else {
tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 840.0: tmp = math.cos(x) else: tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (y <= 840.0) tmp = cos(x); else tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 840.0) tmp = cos(x); else tmp = (0.16666666666666666 * (y * y)) * (1.0 + (-0.5 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 840.0], N[Cos[x], $MachinePrecision], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 840:\\
\;\;\;\;\cos x\\
\mathbf{else}:\\
\;\;\;\;\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
Taylor expanded in y around 0 69.2%
if 840 < y Initial program 100.0%
Taylor expanded in y around 0 55.5%
unpow255.5%
Simplified55.5%
Taylor expanded in x around 0 8.9%
+-commutative8.9%
associate-+l+8.9%
*-commutative8.9%
associate-*l*8.9%
+-commutative8.9%
unpow28.9%
associate-*r*8.9%
*-commutative8.9%
fma-udef8.9%
unpow28.9%
associate-*r*8.9%
*-commutative8.9%
fma-udef8.9%
*-rgt-identity8.9%
distribute-lft-out53.0%
*-commutative53.0%
unpow253.0%
Simplified53.0%
Taylor expanded in y around inf 53.0%
unpow234.5%
Simplified53.0%
Final simplification64.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (* 0.16666666666666666 (* y y)))) (if (<= y 840.0) (+ 1.0 t_0) (* t_0 (+ 1.0 (* -0.5 (* x x)))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = 1.0 + t_0;
} else {
tmp = t_0 * (1.0 + (-0.5 * (x * x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (y * y)
if (y <= 840.0d0) then
tmp = 1.0d0 + t_0
else
tmp = t_0 * (1.0d0 + ((-0.5d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 840.0) {
tmp = 1.0 + t_0;
} else {
tmp = t_0 * (1.0 + (-0.5 * (x * x)));
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 840.0: tmp = 1.0 + t_0 else: tmp = t_0 * (1.0 + (-0.5 * (x * x))) return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 840.0) tmp = Float64(1.0 + t_0); else tmp = Float64(t_0 * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 840.0) tmp = 1.0 + t_0; else tmp = t_0 * (1.0 + (-0.5 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 840.0], N[(1.0 + t$95$0), $MachinePrecision], N[(t$95$0 * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 840:\\
\;\;\;\;1 + t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 840Initial program 100.0%
Taylor expanded in y around 0 84.9%
unpow284.9%
Simplified84.9%
Taylor expanded in x around 0 50.4%
+-commutative50.4%
unpow250.4%
Simplified50.4%
if 840 < y Initial program 100.0%
Taylor expanded in y around 0 55.5%
unpow255.5%
Simplified55.5%
Taylor expanded in x around 0 8.9%
+-commutative8.9%
associate-+l+8.9%
*-commutative8.9%
associate-*l*8.9%
+-commutative8.9%
unpow28.9%
associate-*r*8.9%
*-commutative8.9%
fma-udef8.9%
unpow28.9%
associate-*r*8.9%
*-commutative8.9%
fma-udef8.9%
*-rgt-identity8.9%
distribute-lft-out53.0%
*-commutative53.0%
unpow253.0%
Simplified53.0%
Taylor expanded in y around inf 53.0%
unpow234.5%
Simplified53.0%
Final simplification51.1%
(FPCore (x y) :precision binary64 (if (<= x 1700000000000.0) (+ 1.0 (* 0.16666666666666666 (* y y))) (* -0.08333333333333333 (* (* x y) (* x y)))))
double code(double x, double y) {
double tmp;
if (x <= 1700000000000.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 1700000000000.0d0) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (-0.08333333333333333d0) * ((x * y) * (x * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 1700000000000.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 1700000000000.0: tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = -0.08333333333333333 * ((x * y) * (x * y)) return tmp
function code(x, y) tmp = 0.0 if (x <= 1700000000000.0) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(-0.08333333333333333 * Float64(Float64(x * y) * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 1700000000000.0) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((x * y) * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 1700000000000.0], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.08333333333333333 * N[(N[(x * y), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1700000000000:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(x \cdot y\right) \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 1.7e12Initial program 100.0%
Taylor expanded in y around 0 77.3%
unpow277.3%
Simplified77.3%
Taylor expanded in x around 0 54.0%
+-commutative54.0%
unpow254.0%
Simplified54.0%
if 1.7e12 < x Initial program 100.0%
Taylor expanded in y around 0 76.3%
unpow276.3%
Simplified76.3%
Taylor expanded in x around 0 9.3%
+-commutative9.3%
associate-+l+9.3%
*-commutative9.3%
associate-*l*9.3%
+-commutative9.3%
unpow29.3%
associate-*r*9.3%
*-commutative9.3%
fma-udef9.3%
unpow29.3%
associate-*r*9.3%
*-commutative9.3%
fma-udef9.3%
*-rgt-identity9.3%
distribute-lft-out20.8%
*-commutative20.8%
unpow220.8%
Simplified20.8%
Taylor expanded in y around inf 20.6%
unpow212.4%
Simplified20.6%
Taylor expanded in x around inf 20.6%
unpow220.6%
*-commutative20.6%
unpow220.6%
unswap-sqr21.1%
Simplified21.1%
Final simplification47.3%
(FPCore (x y) :precision binary64 (if (<= y 2.5) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.5d0) then
tmp = 1.0d0
else
tmp = 0.16666666666666666d0 * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.5: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.5) tmp = 1.0; else tmp = Float64(0.16666666666666666 * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.5) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.5], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2.5Initial program 100.0%
Taylor expanded in y around 0 85.4%
unpow285.4%
Simplified85.4%
Taylor expanded in x around 0 50.6%
+-commutative50.6%
unpow250.6%
associate-*r*50.6%
*-commutative50.6%
fma-udef50.6%
Simplified50.6%
Taylor expanded in y around 0 38.8%
if 2.5 < y Initial program 100.0%
Taylor expanded in y around 0 54.7%
unpow254.7%
Simplified54.7%
Taylor expanded in x around 0 34.1%
+-commutative34.1%
unpow234.1%
associate-*r*34.1%
*-commutative34.1%
fma-udef34.1%
Simplified34.1%
Taylor expanded in y around inf 34.1%
unpow234.1%
Simplified34.1%
Final simplification37.5%
(FPCore (x y) :precision binary64 (+ 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
return 1.0 + (0.16666666666666666 * (y * y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0 + (0.16666666666666666d0 * (y * y))
end function
public static double code(double x, double y) {
return 1.0 + (0.16666666666666666 * (y * y));
}
def code(x, y): return 1.0 + (0.16666666666666666 * (y * y))
function code(x, y) return Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) end
function tmp = code(x, y) tmp = 1.0 + (0.16666666666666666 * (y * y)); end
code[x_, y_] := N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.16666666666666666 \cdot \left(y \cdot y\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 77.1%
unpow277.1%
Simplified77.1%
Taylor expanded in x around 0 46.2%
+-commutative46.2%
unpow246.2%
Simplified46.2%
Final simplification46.2%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 77.1%
unpow277.1%
Simplified77.1%
Taylor expanded in x around 0 46.2%
+-commutative46.2%
unpow246.2%
associate-*r*46.2%
*-commutative46.2%
fma-udef46.2%
Simplified46.2%
Taylor expanded in y around 0 29.0%
Final simplification29.0%
herbie shell --seed 2023240
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))