
(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 14 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) (/ (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 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
(if (<= y 2600000000000.0)
t_0
(if (<= y 2.4e+51)
(*
(* y y)
(fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
(if (<= y 2.65e+153)
(cbrt (* (pow y 6.0) 0.004629629629629629))
t_0)))))
double code(double x, double y) {
double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2600000000000.0) {
tmp = t_0;
} else if (y <= 2.4e+51) {
tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = cbrt((pow(y, 6.0) * 0.004629629629629629));
} else {
tmp = t_0;
}
return tmp;
}
public static double code(double x, double y) {
double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2600000000000.0) {
tmp = t_0;
} else if (y <= 2.4e+51) {
tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = Math.cbrt((Math.pow(y, 6.0) * 0.004629629629629629));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) tmp = 0.0 if (y <= 2600000000000.0) tmp = t_0; elseif (y <= 2.4e+51) tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))))); elseif (y <= 2.65e+153) tmp = cbrt(Float64((y ^ 6.0) * 0.004629629629629629)); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2600000000000.0], t$95$0, If[LessEqual[y, 2.4e+51], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], N[Power[N[(N[Power[y, 6.0], $MachinePrecision] * 0.004629629629629629), $MachinePrecision], 1/3], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2600000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.4 \cdot 10^{+51}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 2.6e12 or 2.65e153 < y Initial program 100.0%
Taylor expanded in y around 0 88.9%
unpow288.9%
Simplified88.9%
if 2.6e12 < y < 2.3999999999999999e51Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in y around inf 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 44.0%
fma-def44.0%
unpow244.0%
*-commutative44.0%
unpow244.0%
unpow244.0%
Simplified44.0%
add-sqr-sqrt1.0%
sqrt-unprod15.8%
swap-sqr15.8%
metadata-eval15.8%
pow215.8%
fma-udef15.8%
+-commutative15.8%
fma-def15.8%
*-commutative15.8%
*-commutative15.8%
pow215.8%
pow215.8%
pow-prod-down15.8%
Applied egg-rr15.8%
metadata-eval15.8%
unpow215.8%
swap-sqr15.8%
rem-sqrt-square15.8%
fma-def15.8%
unpow215.8%
distribute-lft-in15.8%
*-commutative15.8%
associate-*r*15.8%
metadata-eval15.8%
unpow215.8%
swap-sqr15.8%
unpow215.8%
unpow215.8%
*-commutative15.8%
associate-*r*15.8%
distribute-rgt-out15.8%
unpow215.8%
Simplified15.8%
if 2.3999999999999999e51 < y < 2.65e153Initial program 100.0%
Taylor expanded in y around 0 6.3%
unpow26.3%
Simplified6.3%
Taylor expanded in y around inf 6.3%
unpow26.3%
Simplified6.3%
Taylor expanded in x around 0 4.3%
unpow24.3%
Simplified4.3%
add-cbrt-cube70.8%
pow370.8%
*-commutative70.8%
unpow-prod-down70.8%
pow-prod-down70.8%
pow-prod-up70.8%
metadata-eval70.8%
metadata-eval70.8%
Applied egg-rr70.8%
Final simplification85.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
(if (<= y 2.4e+16)
t_0
(if (<= y 1.2e+77)
(*
(* y y)
(fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
(if (<= y 2.65e+153)
(/
(- 1.0 (* 0.027777777777777776 (pow y 4.0)))
(+ 1.0 (* (* y y) -0.16666666666666666)))
t_0)))))
double code(double x, double y) {
double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2.4e+16) {
tmp = t_0;
} else if (y <= 1.2e+77) {
tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = (1.0 - (0.027777777777777776 * pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = t_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) :: tmp
t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
if (y <= 2.4d+16) then
tmp = t_0
else if (y <= 1.2d+77) then
tmp = (y * y) * abs((0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
else if (y <= 2.65d+153) then
tmp = (1.0d0 - (0.027777777777777776d0 * (y ** 4.0d0))) / (1.0d0 + ((y * y) * (-0.16666666666666666d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2.4e+16) {
tmp = t_0;
} else if (y <= 1.2e+77) {
tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = (1.0 - (0.027777777777777776 * Math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) tmp = 0 if y <= 2.4e+16: tmp = t_0 elif y <= 1.2e+77: tmp = (y * y) * math.fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x)))) elif y <= 2.65e+153: tmp = (1.0 - (0.027777777777777776 * math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) tmp = 0.0 if (y <= 2.4e+16) tmp = t_0; elseif (y <= 1.2e+77) tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))))); elseif (y <= 2.65e+153) tmp = Float64(Float64(1.0 - Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); tmp = 0.0; if (y <= 2.4e+16) tmp = t_0; elseif (y <= 1.2e+77) tmp = (y * y) * abs((0.16666666666666666 + (-0.08333333333333333 * (x * x)))); elseif (y <= 2.65e+153) tmp = (1.0 - (0.027777777777777776 * (y ^ 4.0))) / (1.0 + ((y * y) * -0.16666666666666666)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.4e+16], t$95$0, If[LessEqual[y, 1.2e+77], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], 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], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2.4 \cdot 10^{+16}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 2.4e16 or 2.65e153 < y Initial program 100.0%
Taylor expanded in y around 0 88.9%
unpow288.9%
Simplified88.9%
if 2.4e16 < y < 1.1999999999999999e77Initial program 100.0%
Taylor expanded in y around 0 4.1%
unpow24.1%
Simplified4.1%
Taylor expanded in y around inf 4.1%
unpow24.1%
Simplified4.1%
Taylor expanded in x around 0 26.9%
fma-def26.9%
unpow226.9%
*-commutative26.9%
unpow226.9%
unpow226.9%
Simplified26.9%
add-sqr-sqrt1.8%
sqrt-unprod21.1%
swap-sqr21.1%
metadata-eval21.1%
pow221.1%
fma-udef21.1%
+-commutative21.1%
fma-def21.1%
*-commutative21.1%
*-commutative21.1%
pow221.1%
pow221.1%
pow-prod-down21.1%
Applied egg-rr21.1%
metadata-eval21.1%
unpow221.1%
swap-sqr21.1%
rem-sqrt-square15.2%
fma-def15.2%
unpow215.2%
distribute-lft-in15.2%
*-commutative15.2%
associate-*r*15.2%
metadata-eval15.2%
unpow215.2%
swap-sqr15.2%
unpow215.2%
unpow215.2%
*-commutative15.2%
associate-*r*15.2%
distribute-rgt-out15.2%
unpow215.2%
Simplified15.2%
if 1.1999999999999999e77 < y < 2.65e153Initial program 100.0%
Taylor expanded in y around 0 7.5%
unpow27.5%
Simplified7.5%
Taylor expanded in x around 0 4.5%
+-commutative4.5%
unpow24.5%
associate-*r*4.5%
*-commutative4.5%
fma-udef4.5%
Simplified4.5%
fma-udef4.5%
+-commutative4.5%
flip-+60.0%
metadata-eval60.0%
div-sub60.0%
*-commutative60.0%
associate-*l*60.0%
pow260.0%
*-commutative60.0%
associate-*l*60.0%
*-commutative60.0%
associate-*l*60.0%
Applied egg-rr60.0%
div-sub60.0%
unpow260.0%
swap-sqr60.0%
metadata-eval60.0%
associate-*r*60.0%
unpow360.0%
pow-plus60.0%
metadata-eval60.0%
sub-neg60.0%
*-commutative60.0%
distribute-rgt-neg-in60.0%
metadata-eval60.0%
Simplified60.0%
Final simplification82.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))))
(if (<= y 2400000000000.0)
t_0
(if (<= y 1.2e+77)
(*
(* y y)
(fabs (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))
(if (<= y 2.65e+153)
(+
1.0
(/
(* 0.027777777777777776 (pow y 4.0))
(* y (* y 0.16666666666666666))))
t_0)))))
double code(double x, double y) {
double t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2400000000000.0) {
tmp = t_0;
} else if (y <= 1.2e+77) {
tmp = (y * y) * fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = 1.0 + ((0.027777777777777776 * pow(y, 4.0)) / (y * (y * 0.16666666666666666)));
} else {
tmp = t_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) :: tmp
t_0 = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
if (y <= 2400000000000.0d0) then
tmp = t_0
else if (y <= 1.2d+77) then
tmp = (y * y) * abs((0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
else if (y <= 2.65d+153) then
tmp = 1.0d0 + ((0.027777777777777776d0 * (y ** 4.0d0)) / (y * (y * 0.16666666666666666d0)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
double tmp;
if (y <= 2400000000000.0) {
tmp = t_0;
} else if (y <= 1.2e+77) {
tmp = (y * y) * Math.abs((0.16666666666666666 + (-0.08333333333333333 * (x * x))));
} else if (y <= 2.65e+153) {
tmp = 1.0 + ((0.027777777777777776 * Math.pow(y, 4.0)) / (y * (y * 0.16666666666666666)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) tmp = 0 if y <= 2400000000000.0: tmp = t_0 elif y <= 1.2e+77: tmp = (y * y) * math.fabs((0.16666666666666666 + (-0.08333333333333333 * (x * x)))) elif y <= 2.65e+153: tmp = 1.0 + ((0.027777777777777776 * math.pow(y, 4.0)) / (y * (y * 0.16666666666666666))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) tmp = 0.0 if (y <= 2400000000000.0) tmp = t_0; elseif (y <= 1.2e+77) tmp = Float64(Float64(y * y) * abs(Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))))); elseif (y <= 2.65e+153) tmp = Float64(1.0 + Float64(Float64(0.027777777777777776 * (y ^ 4.0)) / Float64(y * Float64(y * 0.16666666666666666)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); tmp = 0.0; if (y <= 2400000000000.0) tmp = t_0; elseif (y <= 1.2e+77) tmp = (y * y) * abs((0.16666666666666666 + (-0.08333333333333333 * (x * x)))); elseif (y <= 2.65e+153) tmp = 1.0 + ((0.027777777777777776 * (y ^ 4.0)) / (y * (y * 0.16666666666666666))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2400000000000.0], t$95$0, If[LessEqual[y, 1.2e+77], N[(N[(y * y), $MachinePrecision] * N[Abs[N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e+153], N[(1.0 + N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] / N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq 2400000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{+77}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left|0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right|\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{+153}:\\
\;\;\;\;1 + \frac{0.027777777777777776 \cdot {y}^{4}}{y \cdot \left(y \cdot 0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 2.4e12 or 2.65e153 < y Initial program 100.0%
Taylor expanded in y around 0 88.9%
unpow288.9%
Simplified88.9%
if 2.4e12 < y < 1.1999999999999999e77Initial program 100.0%
Taylor expanded in y around 0 4.1%
unpow24.1%
Simplified4.1%
Taylor expanded in y around inf 4.1%
unpow24.1%
Simplified4.1%
Taylor expanded in x around 0 26.9%
fma-def26.9%
unpow226.9%
*-commutative26.9%
unpow226.9%
unpow226.9%
Simplified26.9%
add-sqr-sqrt1.8%
sqrt-unprod21.1%
swap-sqr21.1%
metadata-eval21.1%
pow221.1%
fma-udef21.1%
+-commutative21.1%
fma-def21.1%
*-commutative21.1%
*-commutative21.1%
pow221.1%
pow221.1%
pow-prod-down21.1%
Applied egg-rr21.1%
metadata-eval21.1%
unpow221.1%
swap-sqr21.1%
rem-sqrt-square15.2%
fma-def15.2%
unpow215.2%
distribute-lft-in15.2%
*-commutative15.2%
associate-*r*15.2%
metadata-eval15.2%
unpow215.2%
swap-sqr15.2%
unpow215.2%
unpow215.2%
*-commutative15.2%
associate-*r*15.2%
distribute-rgt-out15.2%
unpow215.2%
Simplified15.2%
if 1.1999999999999999e77 < y < 2.65e153Initial program 100.0%
Taylor expanded in y around 0 7.5%
unpow27.5%
Simplified7.5%
Taylor expanded in x around 0 4.5%
+-commutative4.5%
unpow24.5%
Simplified4.5%
add-log-exp60.0%
*-un-lft-identity60.0%
log-prod60.0%
metadata-eval60.0%
add-log-exp4.5%
associate-*r*4.5%
*-commutative4.5%
Applied egg-rr4.5%
+-rgt-identity4.5%
flip-+60.0%
metadata-eval60.0%
mul0-lft60.0%
cancel-sign-sub-inv60.0%
metadata-eval60.0%
distribute-rgt-in60.0%
+-rgt-identity60.0%
pow260.0%
*-commutative60.0%
associate-*l*60.0%
fma-neg60.0%
metadata-eval60.0%
fma-def60.0%
+-rgt-identity60.0%
*-commutative60.0%
associate-*l*60.0%
Applied egg-rr60.0%
unpow260.0%
swap-sqr60.0%
metadata-eval60.0%
associate-*r*60.0%
unpow360.0%
pow-plus60.0%
metadata-eval60.0%
associate-*r*60.0%
*-commutative60.0%
Simplified60.0%
Final simplification82.6%
(FPCore (x y)
:precision binary64
(if (<= y 2400.0)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.4e+154)
(* (fma y (* y 0.16666666666666666) 1.0) (+ 1.0 (* (* x x) -0.5)))
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 2400.0) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.4e+154) {
tmp = fma(y, (y * 0.16666666666666666), 1.0) * (1.0 + ((x * x) * -0.5));
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 2400.0) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.4e+154) tmp = Float64(fma(y, Float64(y * 0.16666666666666666), 1.0) * Float64(1.0 + Float64(Float64(x * x) * -0.5))); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
code[x_, y_] := If[LessEqual[y, 2400.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * N[(y * 0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(1.0 + N[(N[(x * x), $MachinePrecision] * -0.5), $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 2400:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(y, y \cdot 0.16666666666666666, 1\right) \cdot \left(1 + \left(x \cdot x\right) \cdot -0.5\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 2400Initial program 100.0%
Taylor expanded in y around 0 87.9%
unpow287.9%
Simplified87.9%
if 2400 < y < 1.4e154Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in x around 0 32.7%
+-commutative32.7%
associate-+l+32.7%
*-commutative32.7%
associate-*l*32.7%
+-commutative32.7%
unpow232.7%
associate-*r*32.7%
*-commutative32.7%
fma-udef32.7%
unpow232.7%
associate-*r*32.7%
*-commutative32.7%
fma-udef32.7%
*-rgt-identity32.7%
distribute-lft-out32.7%
*-commutative32.7%
unpow232.7%
Simplified32.7%
if 1.4e154 < 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 simplification82.4%
(FPCore (x y)
:precision binary64
(if (<= y 380.0)
(cos x)
(if (<= y 1.4e+154)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 380.0) {
tmp = cos(x);
} else if (y <= 1.4e+154) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (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 <= 380.0d0) then
tmp = cos(x)
else if (y <= 1.4d+154) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (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 <= 380.0) {
tmp = Math.cos(x);
} else if (y <= 1.4e+154) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 380.0: tmp = math.cos(x) elif y <= 1.4e+154: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 380.0) tmp = cos(x); elseif (y <= 1.4e+154) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * 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 <= 380.0) tmp = cos(x); elseif (y <= 1.4e+154) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 380.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * 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 380:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \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 < 380Initial program 100.0%
Taylor expanded in y around 0 87.9%
unpow287.9%
Simplified87.9%
Taylor expanded in y around 0 70.2%
if 380 < y < 1.4e154Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in y around inf 5.8%
unpow25.8%
*-commutative5.8%
associate-*l*5.8%
associate-*r*5.8%
*-commutative5.8%
associate-*l*5.8%
Simplified5.8%
Taylor expanded in x around 0 32.7%
*-commutative32.7%
metadata-eval32.7%
*-commutative32.7%
unpow232.7%
unpow232.7%
swap-sqr32.7%
unpow232.7%
associate-*r*32.7%
*-commutative32.7%
*-commutative32.7%
associate-*r*32.7%
metadata-eval32.7%
unpow232.7%
swap-sqr32.7%
unpow232.7%
unpow232.7%
*-commutative32.7%
associate-*r*32.7%
distribute-rgt-out32.7%
unpow232.7%
Simplified32.7%
if 1.4e154 < 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 simplification69.6%
(FPCore (x y)
:precision binary64
(if (<= y 15000.0)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.4e+154)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 15000.0) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.4e+154) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (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 <= 15000.0d0) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1.4d+154) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (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 <= 15000.0) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.4e+154) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 15000.0: tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1.4e+154: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 15000.0) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.4e+154) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * 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 <= 15000.0) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1.4e+154) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 15000.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.4e+154], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * 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 15000:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+154}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \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 < 15000Initial program 100.0%
Taylor expanded in y around 0 87.9%
unpow287.9%
Simplified87.9%
if 15000 < y < 1.4e154Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in y around inf 5.8%
unpow25.8%
*-commutative5.8%
associate-*l*5.8%
associate-*r*5.8%
*-commutative5.8%
associate-*l*5.8%
Simplified5.8%
Taylor expanded in x around 0 32.7%
*-commutative32.7%
metadata-eval32.7%
*-commutative32.7%
unpow232.7%
unpow232.7%
swap-sqr32.7%
unpow232.7%
associate-*r*32.7%
*-commutative32.7%
*-commutative32.7%
associate-*r*32.7%
metadata-eval32.7%
unpow232.7%
swap-sqr32.7%
unpow232.7%
unpow232.7%
*-commutative32.7%
associate-*r*32.7%
distribute-rgt-out32.7%
unpow232.7%
Simplified32.7%
if 1.4e154 < 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 simplification82.4%
(FPCore (x y)
:precision binary64
(if (<= y 920.0)
(cos x)
(if (<= y 1e+165)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 920.0) {
tmp = cos(x);
} else if (y <= 1e+165) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 1.0 + (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 <= 920.0d0) then
tmp = cos(x)
else if (y <= 1d+165) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 920.0) {
tmp = Math.cos(x);
} else if (y <= 1e+165) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 920.0: tmp = math.cos(x) elif y <= 1e+165: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 920.0) tmp = cos(x); elseif (y <= 1e+165) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); else tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 920.0) tmp = cos(x); elseif (y <= 1e+165) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 920.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1e+165], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 920:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 10^{+165}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 920Initial program 100.0%
Taylor expanded in y around 0 87.9%
unpow287.9%
Simplified87.9%
Taylor expanded in y around 0 70.2%
if 920 < y < 9.99999999999999899e164Initial program 100.0%
Taylor expanded in y around 0 17.9%
unpow217.9%
Simplified17.9%
Taylor expanded in y around inf 17.9%
unpow217.9%
*-commutative17.9%
associate-*l*17.9%
associate-*r*17.9%
*-commutative17.9%
associate-*l*17.9%
Simplified17.9%
Taylor expanded in x around 0 28.5%
*-commutative28.5%
metadata-eval28.5%
*-commutative28.5%
unpow228.5%
unpow228.5%
swap-sqr33.6%
unpow233.6%
associate-*r*33.6%
*-commutative33.6%
*-commutative33.6%
associate-*r*33.6%
metadata-eval33.6%
unpow233.6%
swap-sqr28.5%
unpow228.5%
unpow228.5%
*-commutative28.5%
associate-*r*28.5%
distribute-rgt-out38.7%
unpow238.7%
Simplified38.7%
if 9.99999999999999899e164 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 81.8%
+-commutative81.8%
unpow281.8%
Simplified81.8%
Final simplification66.9%
(FPCore (x y) :precision binary64 (if (or (<= y 84000.0) (not (<= y 5e+164))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* y (* y (+ 0.16666666666666666 (* -0.08333333333333333 (* x x)))))))
double code(double x, double y) {
double tmp;
if ((y <= 84000.0) || !(y <= 5e+164)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (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 <= 84000.0d0) .or. (.not. (y <= 5d+164))) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = y * (y * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 84000.0) || !(y <= 5e+164)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x))));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 84000.0) or not (y <= 5e+164): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 84000.0) || !(y <= 5e+164)) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x))))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 84000.0) || ~((y <= 5e+164))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = y * (y * (0.16666666666666666 + (-0.08333333333333333 * (x * x)))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 84000.0], N[Not[LessEqual[y, 5e+164]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(y * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 84000 \lor \neg \left(y \leq 5 \cdot 10^{+164}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if y < 84000 or 4.9999999999999995e164 < y Initial program 100.0%
Taylor expanded in y around 0 89.8%
unpow289.8%
Simplified89.8%
Taylor expanded in x around 0 57.1%
+-commutative57.1%
unpow257.1%
Simplified57.1%
if 84000 < y < 4.9999999999999995e164Initial program 100.0%
Taylor expanded in y around 0 17.9%
unpow217.9%
Simplified17.9%
Taylor expanded in y around inf 17.9%
unpow217.9%
*-commutative17.9%
associate-*l*17.9%
associate-*r*17.9%
*-commutative17.9%
associate-*l*17.9%
Simplified17.9%
Taylor expanded in x around 0 38.7%
+-commutative38.7%
*-commutative38.7%
associate-*r*38.7%
distribute-rgt-out38.7%
unpow238.7%
Simplified38.7%
Final simplification54.3%
(FPCore (x y) :precision binary64 (if (or (<= y 13800.0) (not (<= y 7.8e+164))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
double code(double x, double y) {
double tmp;
if ((y <= 13800.0) || !(y <= 7.8e+164)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (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 <= 13800.0d0) .or. (.not. (y <= 7.8d+164))) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 13800.0) || !(y <= 7.8e+164)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 13800.0) or not (y <= 7.8e+164): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 13800.0) || !(y <= 7.8e+164)) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 13800.0) || ~((y <= 7.8e+164))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 13800.0], N[Not[LessEqual[y, 7.8e+164]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 7.8 \cdot 10^{+164}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 13800 or 7.79999999999999971e164 < y Initial program 100.0%
Taylor expanded in y around 0 89.8%
unpow289.8%
Simplified89.8%
Taylor expanded in x around 0 57.1%
+-commutative57.1%
unpow257.1%
Simplified57.1%
if 13800 < y < 7.79999999999999971e164Initial program 100.0%
Taylor expanded in y around 0 17.9%
unpow217.9%
Simplified17.9%
Taylor expanded in y around inf 17.9%
unpow217.9%
*-commutative17.9%
associate-*l*17.9%
associate-*r*17.9%
*-commutative17.9%
associate-*l*17.9%
Simplified17.9%
Taylor expanded in x around 0 28.5%
*-commutative28.5%
metadata-eval28.5%
*-commutative28.5%
unpow228.5%
unpow228.5%
swap-sqr33.6%
unpow233.6%
associate-*r*33.6%
*-commutative33.6%
*-commutative33.6%
associate-*r*33.6%
metadata-eval33.6%
unpow233.6%
swap-sqr28.5%
unpow228.5%
unpow228.5%
*-commutative28.5%
associate-*r*28.5%
distribute-rgt-out38.7%
unpow238.7%
Simplified38.7%
Final simplification54.3%
(FPCore (x y) :precision binary64 (if (or (<= y 13800.0) (not (<= y 1.4e+154))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
double tmp;
if ((y <= 13800.0) || !(y <= 1.4e+154)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (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 <= 13800.0d0) .or. (.not. (y <= 1.4d+154))) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (-0.08333333333333333d0) * ((y * y) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 13800.0) || !(y <= 1.4e+154)) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 13800.0) or not (y <= 1.4e+154): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = -0.08333333333333333 * ((y * y) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if ((y <= 13800.0) || !(y <= 1.4e+154)) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 13800.0) || ~((y <= 1.4e+154))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((y * y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 13800.0], N[Not[LessEqual[y, 1.4e+154]], $MachinePrecision]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 13800 \lor \neg \left(y \leq 1.4 \cdot 10^{+154}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 13800 or 1.4e154 < y Initial program 100.0%
Taylor expanded in y around 0 90.0%
unpow290.0%
Simplified90.0%
Taylor expanded in x around 0 57.1%
+-commutative57.1%
unpow257.1%
Simplified57.1%
if 13800 < y < 1.4e154Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in y around inf 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in x around 0 32.7%
fma-def32.7%
unpow232.7%
*-commutative32.7%
unpow232.7%
unpow232.7%
Simplified32.7%
Taylor expanded in x around inf 30.7%
*-commutative30.7%
unpow230.7%
unpow230.7%
Simplified30.7%
Final simplification53.6%
(FPCore (x y) :precision binary64 (if (<= y 2400000000000.0) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2400000000000.0) {
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 <= 2400000000000.0d0) 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 <= 2400000000000.0) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2400000000000.0: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2400000000000.0) 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 <= 2400000000000.0) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2400000000000.0], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2400000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2.4e12Initial program 100.0%
Taylor expanded in y around 0 87.0%
unpow287.0%
Simplified87.0%
Taylor expanded in x around 0 52.1%
+-commutative52.1%
unpow252.1%
associate-*r*52.1%
*-commutative52.1%
fma-udef52.1%
Simplified52.1%
Taylor expanded in y around 0 38.2%
if 2.4e12 < y Initial program 100.0%
Taylor expanded in y around 0 57.0%
unpow257.0%
Simplified57.0%
Taylor expanded in y around inf 57.0%
unpow257.0%
Simplified57.0%
Taylor expanded in x around 0 44.5%
unpow244.5%
Simplified44.5%
Final simplification39.9%
(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 78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
unpow250.0%
Simplified50.0%
Final simplification50.0%
(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 78.8%
unpow278.8%
Simplified78.8%
Taylor expanded in x around 0 50.0%
+-commutative50.0%
unpow250.0%
associate-*r*50.0%
*-commutative50.0%
fma-udef50.0%
Simplified50.0%
Taylor expanded in y around 0 28.4%
Final simplification28.4%
herbie shell --seed 2023229
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))