
(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 15 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 (* (/ (sinh y) y) (+ 1.0 (* -0.5 (* x x)))))
(t_1 (* 0.16666666666666666 (* y y))))
(if (<= y 190.0)
(* (cos x) (+ 1.0 t_1))
(if (<= y 5.4e+71)
t_0
(if (<= y 3.8e+129)
(/ (+ (* 0.027777777777777776 (pow y 4.0)) -1.0) (+ t_1 -1.0))
(if (<= y 1.9e+153)
t_0
(* y (* (cos x) (* y 0.16666666666666666)))))))))
double code(double x, double y) {
double t_0 = (sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
double t_1 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 190.0) {
tmp = cos(x) * (1.0 + t_1);
} else if (y <= 5.4e+71) {
tmp = t_0;
} else if (y <= 3.8e+129) {
tmp = ((0.027777777777777776 * pow(y, 4.0)) + -1.0) / (t_1 + -1.0);
} else if (y <= 1.9e+153) {
tmp = t_0;
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
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 = (sinh(y) / y) * (1.0d0 + ((-0.5d0) * (x * x)))
t_1 = 0.16666666666666666d0 * (y * y)
if (y <= 190.0d0) then
tmp = cos(x) * (1.0d0 + t_1)
else if (y <= 5.4d+71) then
tmp = t_0
else if (y <= 3.8d+129) then
tmp = ((0.027777777777777776d0 * (y ** 4.0d0)) + (-1.0d0)) / (t_1 + (-1.0d0))
else if (y <= 1.9d+153) then
tmp = t_0
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (Math.sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
double t_1 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 190.0) {
tmp = Math.cos(x) * (1.0 + t_1);
} else if (y <= 5.4e+71) {
tmp = t_0;
} else if (y <= 3.8e+129) {
tmp = ((0.027777777777777776 * Math.pow(y, 4.0)) + -1.0) / (t_1 + -1.0);
} else if (y <= 1.9e+153) {
tmp = t_0;
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): t_0 = (math.sinh(y) / y) * (1.0 + (-0.5 * (x * x))) t_1 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 190.0: tmp = math.cos(x) * (1.0 + t_1) elif y <= 5.4e+71: tmp = t_0 elif y <= 3.8e+129: tmp = ((0.027777777777777776 * math.pow(y, 4.0)) + -1.0) / (t_1 + -1.0) elif y <= 1.9e+153: tmp = t_0 else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
function code(x, y) t_0 = Float64(Float64(sinh(y) / y) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))) t_1 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 190.0) tmp = Float64(cos(x) * Float64(1.0 + t_1)); elseif (y <= 5.4e+71) tmp = t_0; elseif (y <= 3.8e+129) tmp = Float64(Float64(Float64(0.027777777777777776 * (y ^ 4.0)) + -1.0) / Float64(t_1 + -1.0)); elseif (y <= 1.9e+153) tmp = t_0; else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) t_0 = (sinh(y) / y) * (1.0 + (-0.5 * (x * x))); t_1 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 190.0) tmp = cos(x) * (1.0 + t_1); elseif (y <= 5.4e+71) tmp = t_0; elseif (y <= 3.8e+129) tmp = ((0.027777777777777776 * (y ^ 4.0)) + -1.0) / (t_1 + -1.0); elseif (y <= 1.9e+153) tmp = t_0; else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 190.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+71], t$95$0, If[LessEqual[y, 3.8e+129], N[(N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision] / N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+153], t$95$0, N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\cos x \cdot \left(1 + t_1\right)\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 3.8 \cdot 10^{+129}:\\
\;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4} + -1}{t_1 + -1}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 84.7%
unpow284.7%
Simplified84.7%
if 190 < y < 5.39999999999999993e71 or 3.80000000000000005e129 < y < 1.89999999999999983e153Initial program 100.0%
Taylor expanded in x around 0 76.5%
unpow28.8%
Simplified76.5%
if 5.39999999999999993e71 < y < 3.80000000000000005e129Initial program 100.0%
Taylor expanded in y around 0 5.7%
unpow25.7%
Simplified5.7%
Taylor expanded in x around 0 4.7%
+-commutative4.7%
unpow24.7%
fma-udef4.7%
Simplified4.7%
fma-udef4.7%
flip-+80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
metadata-eval80.0%
Applied egg-rr80.0%
if 1.89999999999999983e153 < 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%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification86.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (/ (sinh y) y) (+ 1.0 (* -0.5 (* x x)))))
(t_1 (* 0.16666666666666666 (* y y))))
(if (<= y 190.0)
(* (cos x) (+ 1.0 t_1))
(if (<= y 5.4e+71)
t_0
(if (<= y 2.55e+129)
(/ (* 0.027777777777777776 (pow y 4.0)) (+ t_1 -1.0))
(if (<= y 1.9e+153)
t_0
(* y (* (cos x) (* y 0.16666666666666666)))))))))
double code(double x, double y) {
double t_0 = (sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
double t_1 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 190.0) {
tmp = cos(x) * (1.0 + t_1);
} else if (y <= 5.4e+71) {
tmp = t_0;
} else if (y <= 2.55e+129) {
tmp = (0.027777777777777776 * pow(y, 4.0)) / (t_1 + -1.0);
} else if (y <= 1.9e+153) {
tmp = t_0;
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
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 = (sinh(y) / y) * (1.0d0 + ((-0.5d0) * (x * x)))
t_1 = 0.16666666666666666d0 * (y * y)
if (y <= 190.0d0) then
tmp = cos(x) * (1.0d0 + t_1)
else if (y <= 5.4d+71) then
tmp = t_0
else if (y <= 2.55d+129) then
tmp = (0.027777777777777776d0 * (y ** 4.0d0)) / (t_1 + (-1.0d0))
else if (y <= 1.9d+153) then
tmp = t_0
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (Math.sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
double t_1 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 190.0) {
tmp = Math.cos(x) * (1.0 + t_1);
} else if (y <= 5.4e+71) {
tmp = t_0;
} else if (y <= 2.55e+129) {
tmp = (0.027777777777777776 * Math.pow(y, 4.0)) / (t_1 + -1.0);
} else if (y <= 1.9e+153) {
tmp = t_0;
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): t_0 = (math.sinh(y) / y) * (1.0 + (-0.5 * (x * x))) t_1 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 190.0: tmp = math.cos(x) * (1.0 + t_1) elif y <= 5.4e+71: tmp = t_0 elif y <= 2.55e+129: tmp = (0.027777777777777776 * math.pow(y, 4.0)) / (t_1 + -1.0) elif y <= 1.9e+153: tmp = t_0 else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
function code(x, y) t_0 = Float64(Float64(sinh(y) / y) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))) t_1 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 190.0) tmp = Float64(cos(x) * Float64(1.0 + t_1)); elseif (y <= 5.4e+71) tmp = t_0; elseif (y <= 2.55e+129) tmp = Float64(Float64(0.027777777777777776 * (y ^ 4.0)) / Float64(t_1 + -1.0)); elseif (y <= 1.9e+153) tmp = t_0; else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) t_0 = (sinh(y) / y) * (1.0 + (-0.5 * (x * x))); t_1 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 190.0) tmp = cos(x) * (1.0 + t_1); elseif (y <= 5.4e+71) tmp = t_0; elseif (y <= 2.55e+129) tmp = (0.027777777777777776 * (y ^ 4.0)) / (t_1 + -1.0); elseif (y <= 1.9e+153) tmp = t_0; else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 190.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.4e+71], t$95$0, If[LessEqual[y, 2.55e+129], N[(N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision] / N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+153], t$95$0, N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
t_1 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\cos x \cdot \left(1 + t_1\right)\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+71}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 2.55 \cdot 10^{+129}:\\
\;\;\;\;\frac{0.027777777777777776 \cdot {y}^{4}}{t_1 + -1}\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 84.7%
unpow284.7%
Simplified84.7%
if 190 < y < 5.39999999999999993e71 or 2.54999999999999998e129 < y < 1.89999999999999983e153Initial program 100.0%
Taylor expanded in x around 0 76.5%
unpow28.8%
Simplified76.5%
if 5.39999999999999993e71 < y < 2.54999999999999998e129Initial program 100.0%
Taylor expanded in y around 0 5.7%
unpow25.7%
Simplified5.7%
Taylor expanded in x around 0 4.7%
+-commutative4.7%
unpow24.7%
fma-udef4.7%
Simplified4.7%
fma-udef4.7%
flip-+80.0%
swap-sqr80.0%
metadata-eval80.0%
pow280.0%
pow280.0%
pow-prod-up80.0%
metadata-eval80.0%
metadata-eval80.0%
Applied egg-rr80.0%
Taylor expanded in y around inf 80.0%
if 1.89999999999999983e153 < 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%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification86.0%
(FPCore (x y)
:precision binary64
(if (<= y 190.0)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.9e+153)
(* (/ (sinh y) y) (+ 1.0 (* -0.5 (* x x))))
(* y (* (cos x) (* y 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.9e+153) {
tmp = (sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 190.0d0) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1.9d+153) then
tmp = (sinh(y) / y) * (1.0d0 + ((-0.5d0) * (x * x)))
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 190.0) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.9e+153) {
tmp = (Math.sinh(y) / y) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 190.0: tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1.9e+153: tmp = (math.sinh(y) / y) * (1.0 + (-0.5 * (x * x))) else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 190.0) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.9e+153) tmp = Float64(Float64(sinh(y) / y) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 190.0) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1.9e+153) tmp = (sinh(y) / y) * (1.0 + (-0.5 * (x * x))); else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 190.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.9e+153], N[(N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 190:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\frac{\sinh y}{y} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 190Initial program 100.0%
Taylor expanded in y around 0 84.7%
unpow284.7%
Simplified84.7%
if 190 < y < 1.89999999999999983e153Initial program 100.0%
Taylor expanded in x around 0 66.7%
unpow26.2%
Simplified66.7%
if 1.89999999999999983e153 < 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%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification84.8%
(FPCore (x y)
:precision binary64
(if (<= y 13000000000000.0)
(cos x)
(if (<= y 1.9e+153)
(* (+ 1.0 (* -0.5 (* x x))) (+ 1.0 (* 0.16666666666666666 (* y y))))
(* y (* (cos x) (* y 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if (y <= 13000000000000.0) {
tmp = cos(x);
} else if (y <= 1.9e+153) {
tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 13000000000000.0d0) then
tmp = cos(x)
else if (y <= 1.9d+153) then
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 13000000000000.0) {
tmp = Math.cos(x);
} else if (y <= 1.9e+153) {
tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 13000000000000.0: tmp = math.cos(x) elif y <= 1.9e+153: tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 13000000000000.0) tmp = cos(x); elseif (y <= 1.9e+153) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 13000000000000.0) tmp = cos(x); elseif (y <= 1.9e+153) tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 13000000000000.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.9e+153], N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 13000000000000:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+153}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 1.3e13Initial program 100.0%
Taylor expanded in y around 0 83.8%
unpow283.8%
Simplified83.8%
Taylor expanded in y around 0 69.2%
if 1.3e13 < y < 1.89999999999999983e153Initial program 100.0%
Taylor expanded in y around 0 5.3%
unpow25.3%
Simplified5.3%
Taylor expanded in x around 0 15.1%
unpow26.5%
Simplified15.1%
if 1.89999999999999983e153 < 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%
associate-*r*100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification68.0%
(FPCore (x y) :precision binary64 (* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
def code(x, y): return math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 78.3%
unpow278.3%
Simplified78.3%
Final simplification78.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= y 13000000000000.0)
(cos x)
(if (or (<= y 2e+184) (not (<= y 9.5e+232)))
(* (+ 1.0 (* -0.5 (* x x))) t_0)
t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (y <= 13000000000000.0) {
tmp = cos(x);
} else if ((y <= 2e+184) || !(y <= 9.5e+232)) {
tmp = (1.0 + (-0.5 * (x * x))) * t_0;
} 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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (y <= 13000000000000.0d0) then
tmp = cos(x)
else if ((y <= 2d+184) .or. (.not. (y <= 9.5d+232))) then
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * t_0
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (y <= 13000000000000.0) {
tmp = Math.cos(x);
} else if ((y <= 2e+184) || !(y <= 9.5e+232)) {
tmp = (1.0 + (-0.5 * (x * x))) * t_0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if y <= 13000000000000.0: tmp = math.cos(x) elif (y <= 2e+184) or not (y <= 9.5e+232): tmp = (1.0 + (-0.5 * (x * x))) * t_0 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (y <= 13000000000000.0) tmp = cos(x); elseif ((y <= 2e+184) || !(y <= 9.5e+232)) tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * t_0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (y <= 13000000000000.0) tmp = cos(x); elseif ((y <= 2e+184) || ~((y <= 9.5e+232))) tmp = (1.0 + (-0.5 * (x * x))) * t_0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 13000000000000.0], N[Cos[x], $MachinePrecision], If[Or[LessEqual[y, 2e+184], N[Not[LessEqual[y, 9.5e+232]], $MachinePrecision]], N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 13000000000000:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 2 \cdot 10^{+184} \lor \neg \left(y \leq 9.5 \cdot 10^{+232}\right):\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < 1.3e13Initial program 100.0%
Taylor expanded in y around 0 83.8%
unpow283.8%
Simplified83.8%
Taylor expanded in y around 0 69.2%
if 1.3e13 < y < 2.00000000000000003e184 or 9.4999999999999996e232 < y Initial program 100.0%
Taylor expanded in y around 0 49.6%
unpow249.6%
Simplified49.6%
Taylor expanded in x around 0 46.3%
unpow212.9%
Simplified46.3%
if 2.00000000000000003e184 < y < 9.4999999999999996e232Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 91.7%
+-commutative91.7%
unpow291.7%
fma-udef91.7%
Simplified91.7%
fma-udef91.7%
Applied egg-rr91.7%
Final simplification66.1%
(FPCore (x y) :precision binary64 (if (or (<= y 122.0) (and (not (<= y 5.3e+184)) (<= y 4.8e+246))) (+ 1.0 (* 0.16666666666666666 (* y y))) (* y (* y (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))))
double code(double x, double y) {
double tmp;
if ((y <= 122.0) || (!(y <= 5.3e+184) && (y <= 4.8e+246))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 122.0d0) .or. (.not. (y <= 5.3d+184)) .and. (y <= 4.8d+246)) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = y * (y * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 122.0) || (!(y <= 5.3e+184) && (y <= 4.8e+246))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 122.0) or (not (y <= 5.3e+184) and (y <= 4.8e+246)): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 122.0) || (!(y <= 5.3e+184) && (y <= 4.8e+246))) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 122.0) || (~((y <= 5.3e+184)) && (y <= 4.8e+246))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 122.0], And[N[Not[LessEqual[y, 5.3e+184]], $MachinePrecision], LessEqual[y, 4.8e+246]]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(y * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 122 \lor \neg \left(y \leq 5.3 \cdot 10^{+184}\right) \land y \leq 4.8 \cdot 10^{+246}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\right)\\
\end{array}
\end{array}
if y < 122 or 5.30000000000000022e184 < y < 4.8e246Initial program 100.0%
Taylor expanded in y around 0 85.8%
unpow285.8%
Simplified85.8%
Taylor expanded in x around 0 53.6%
+-commutative53.6%
unpow253.6%
fma-udef53.6%
Simplified53.6%
fma-udef53.6%
Applied egg-rr53.6%
if 122 < y < 5.30000000000000022e184 or 4.8e246 < y Initial program 100.0%
Taylor expanded in y around 0 43.1%
unpow243.1%
Simplified43.1%
Taylor expanded in y around inf 43.1%
unpow243.1%
associate-*r*43.1%
*-commutative43.1%
associate-*r*43.1%
associate-*r*43.1%
*-commutative43.1%
Simplified43.1%
Taylor expanded in x around 0 39.7%
+-commutative39.7%
*-commutative39.7%
*-commutative39.7%
unpow239.7%
associate-*l*39.7%
distribute-lft-out39.7%
Simplified39.7%
Final simplification51.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* -0.5 (* x x))))
(t_1 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 2.8e+219) (* t_0 t_1) (if (<= x 2.8e+277) t_1 t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (-0.5 * (x * x));
double t_1 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.8e+219) {
tmp = t_0 * t_1;
} else if (x <= 2.8e+277) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = 1.0d0 + ((-0.5d0) * (x * x))
t_1 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 2.8d+219) then
tmp = t_0 * t_1
else if (x <= 2.8d+277) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (-0.5 * (x * x));
double t_1 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.8e+219) {
tmp = t_0 * t_1;
} else if (x <= 2.8e+277) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (-0.5 * (x * x)) t_1 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 2.8e+219: tmp = t_0 * t_1 elif x <= 2.8e+277: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(-0.5 * Float64(x * x))) t_1 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 2.8e+219) tmp = Float64(t_0 * t_1); elseif (x <= 2.8e+277) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (-0.5 * (x * x)); t_1 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 2.8e+219) tmp = t_0 * t_1; elseif (x <= 2.8e+277) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.8e+219], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[x, 2.8e+277], t$95$1, t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + -0.5 \cdot \left(x \cdot x\right)\\
t_1 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 2.8 \cdot 10^{+219}:\\
\;\;\;\;t_0 \cdot t_1\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < 2.80000000000000015e219Initial program 100.0%
Taylor expanded in y around 0 78.4%
unpow278.4%
Simplified78.4%
Taylor expanded in x around 0 54.4%
unpow238.3%
Simplified54.4%
if 2.80000000000000015e219 < x < 2.79999999999999985e277Initial program 99.8%
Taylor expanded in y around 0 82.6%
unpow282.6%
Simplified82.6%
Taylor expanded in x around 0 49.5%
+-commutative49.5%
unpow249.5%
fma-udef49.5%
Simplified49.5%
fma-udef49.5%
Applied egg-rr49.5%
if 2.79999999999999985e277 < x Initial program 100.0%
Taylor expanded in y around 0 64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in y around 0 22.5%
Taylor expanded in x around 0 60.6%
unpow260.6%
Simplified60.6%
Final simplification54.3%
(FPCore (x y)
:precision binary64
(if (<= y 2.4)
1.0
(if (or (<= y 1.9e+170) (not (<= y 2.05e+183)))
(* 0.16666666666666666 (* y y))
(+ 1.0 (* -0.5 (* x x))))))
double code(double x, double y) {
double tmp;
if (y <= 2.4) {
tmp = 1.0;
} else if ((y <= 1.9e+170) || !(y <= 2.05e+183)) {
tmp = 0.16666666666666666 * (y * y);
} else {
tmp = 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 <= 2.4d0) then
tmp = 1.0d0
else if ((y <= 1.9d+170) .or. (.not. (y <= 2.05d+183))) then
tmp = 0.16666666666666666d0 * (y * y)
else
tmp = 1.0d0 + ((-0.5d0) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.4) {
tmp = 1.0;
} else if ((y <= 1.9e+170) || !(y <= 2.05e+183)) {
tmp = 0.16666666666666666 * (y * y);
} else {
tmp = 1.0 + (-0.5 * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.4: tmp = 1.0 elif (y <= 1.9e+170) or not (y <= 2.05e+183): tmp = 0.16666666666666666 * (y * y) else: tmp = 1.0 + (-0.5 * (x * x)) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.4) tmp = 1.0; elseif ((y <= 1.9e+170) || !(y <= 2.05e+183)) tmp = Float64(0.16666666666666666 * Float64(y * y)); else tmp = Float64(1.0 + Float64(-0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.4) tmp = 1.0; elseif ((y <= 1.9e+170) || ~((y <= 2.05e+183))) tmp = 0.16666666666666666 * (y * y); else tmp = 1.0 + (-0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.4], 1.0, If[Or[LessEqual[y, 1.9e+170], N[Not[LessEqual[y, 2.05e+183]], $MachinePrecision]], N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.4:\\
\;\;\;\;1\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+170} \lor \neg \left(y \leq 2.05 \cdot 10^{+183}\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if y < 2.39999999999999991Initial program 100.0%
Taylor expanded in y around 0 84.7%
unpow284.7%
Simplified84.7%
Taylor expanded in x around 0 50.3%
+-commutative50.3%
unpow250.3%
fma-udef50.3%
Simplified50.3%
Taylor expanded in y around 0 41.8%
if 2.39999999999999991 < y < 1.8999999999999999e170 or 2.05000000000000007e183 < y Initial program 100.0%
Taylor expanded in y around 0 55.1%
unpow255.1%
Simplified55.1%
Taylor expanded in x around 0 47.5%
+-commutative47.5%
unpow247.5%
fma-udef47.5%
Simplified47.5%
Taylor expanded in y around inf 47.5%
unpow247.5%
Simplified47.5%
if 1.8999999999999999e170 < y < 2.05000000000000007e183Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 3.1%
Taylor expanded in x around 0 75.8%
unpow275.8%
Simplified75.8%
Final simplification43.6%
(FPCore (x y) :precision binary64 (if (or (<= x 2.12e+164) (and (not (<= x 2.8e+219)) (<= x 2.8e+277))) (+ 1.0 (* 0.16666666666666666 (* y y))) (+ 1.0 (* -0.5 (* x x)))))
double code(double x, double y) {
double tmp;
if ((x <= 2.12e+164) || (!(x <= 2.8e+219) && (x <= 2.8e+277))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = 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 ((x <= 2.12d+164) .or. (.not. (x <= 2.8d+219)) .and. (x <= 2.8d+277)) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = 1.0d0 + ((-0.5d0) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= 2.12e+164) || (!(x <= 2.8e+219) && (x <= 2.8e+277))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = 1.0 + (-0.5 * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= 2.12e+164) or (not (x <= 2.8e+219) and (x <= 2.8e+277)): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = 1.0 + (-0.5 * (x * x)) return tmp
function code(x, y) tmp = 0.0 if ((x <= 2.12e+164) || (!(x <= 2.8e+219) && (x <= 2.8e+277))) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(1.0 + Float64(-0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= 2.12e+164) || (~((x <= 2.8e+219)) && (x <= 2.8e+277))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = 1.0 + (-0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, 2.12e+164], And[N[Not[LessEqual[x, 2.8e+219]], $MachinePrecision], LessEqual[x, 2.8e+277]]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.12 \cdot 10^{+164} \lor \neg \left(x \leq 2.8 \cdot 10^{+219}\right) \land x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 2.11999999999999993e164 or 2.80000000000000015e219 < x < 2.79999999999999985e277Initial program 100.0%
Taylor expanded in y around 0 78.5%
unpow278.5%
Simplified78.5%
Taylor expanded in x around 0 52.2%
+-commutative52.2%
unpow252.2%
fma-udef52.2%
Simplified52.2%
fma-udef52.2%
Applied egg-rr52.2%
if 2.11999999999999993e164 < x < 2.80000000000000015e219 or 2.79999999999999985e277 < x Initial program 100.0%
Taylor expanded in y around 0 75.9%
unpow275.9%
Simplified75.9%
Taylor expanded in y around 0 43.9%
Taylor expanded in x around 0 32.8%
unpow232.8%
Simplified32.8%
Final simplification50.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 2.65e+20)
t_0
(if (<= x 2.8e+219)
(* -0.08333333333333333 (* (* y y) (* x x)))
(if (<= x 2.8e+277) t_0 (+ 1.0 (* -0.5 (* x x))))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.65e+20) {
tmp = t_0;
} else if (x <= 2.8e+219) {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
} else if (x <= 2.8e+277) {
tmp = t_0;
} else {
tmp = 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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 2.65d+20) then
tmp = t_0
else if (x <= 2.8d+219) then
tmp = (-0.08333333333333333d0) * ((y * y) * (x * x))
else if (x <= 2.8d+277) then
tmp = t_0
else
tmp = 1.0d0 + ((-0.5d0) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.65e+20) {
tmp = t_0;
} else if (x <= 2.8e+219) {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
} else if (x <= 2.8e+277) {
tmp = t_0;
} else {
tmp = 1.0 + (-0.5 * (x * x));
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 2.65e+20: tmp = t_0 elif x <= 2.8e+219: tmp = -0.08333333333333333 * ((y * y) * (x * x)) elif x <= 2.8e+277: tmp = t_0 else: tmp = 1.0 + (-0.5 * (x * x)) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 2.65e+20) tmp = t_0; elseif (x <= 2.8e+219) tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * Float64(x * x))); elseif (x <= 2.8e+277) tmp = t_0; else tmp = Float64(1.0 + Float64(-0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 2.65e+20) tmp = t_0; elseif (x <= 2.8e+219) tmp = -0.08333333333333333 * ((y * y) * (x * x)); elseif (x <= 2.8e+277) tmp = t_0; else tmp = 1.0 + (-0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.65e+20], t$95$0, If[LessEqual[x, 2.8e+219], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+277], t$95$0, N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+219}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 2.65e20 or 2.80000000000000015e219 < x < 2.79999999999999985e277Initial program 100.0%
Taylor expanded in y around 0 79.2%
unpow279.2%
Simplified79.2%
Taylor expanded in x around 0 57.8%
+-commutative57.8%
unpow257.8%
fma-udef57.8%
Simplified57.8%
fma-udef57.8%
Applied egg-rr57.8%
if 2.65e20 < x < 2.80000000000000015e219Initial program 100.0%
Taylor expanded in y around 0 76.0%
unpow276.0%
Simplified76.0%
Taylor expanded in y around inf 27.2%
unpow227.2%
associate-*r*27.2%
*-commutative27.2%
associate-*r*27.2%
associate-*r*27.2%
*-commutative27.2%
Simplified27.2%
Taylor expanded in x around 0 20.7%
+-commutative20.7%
*-commutative20.7%
*-commutative20.7%
unpow220.7%
associate-*l*20.7%
distribute-lft-out20.7%
Simplified20.7%
Taylor expanded in x around inf 20.5%
unpow220.5%
unpow220.5%
Simplified20.5%
if 2.79999999999999985e277 < x Initial program 100.0%
Taylor expanded in y around 0 64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in y around 0 22.5%
Taylor expanded in x around 0 60.6%
unpow260.6%
Simplified60.6%
Final simplification51.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 2.65e+20)
t_0
(if (<= x 2.8e+219)
(* y (* -0.08333333333333333 (* y (* x x))))
(if (<= x 2.8e+277) t_0 (+ 1.0 (* -0.5 (* x x))))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.65e+20) {
tmp = t_0;
} else if (x <= 2.8e+219) {
tmp = y * (-0.08333333333333333 * (y * (x * x)));
} else if (x <= 2.8e+277) {
tmp = t_0;
} else {
tmp = 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 = 1.0d0 + (0.16666666666666666d0 * (y * y))
if (x <= 2.65d+20) then
tmp = t_0
else if (x <= 2.8d+219) then
tmp = y * ((-0.08333333333333333d0) * (y * (x * x)))
else if (x <= 2.8d+277) then
tmp = t_0
else
tmp = 1.0d0 + ((-0.5d0) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 2.65e+20) {
tmp = t_0;
} else if (x <= 2.8e+219) {
tmp = y * (-0.08333333333333333 * (y * (x * x)));
} else if (x <= 2.8e+277) {
tmp = t_0;
} else {
tmp = 1.0 + (-0.5 * (x * x));
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 2.65e+20: tmp = t_0 elif x <= 2.8e+219: tmp = y * (-0.08333333333333333 * (y * (x * x))) elif x <= 2.8e+277: tmp = t_0 else: tmp = 1.0 + (-0.5 * (x * x)) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 2.65e+20) tmp = t_0; elseif (x <= 2.8e+219) tmp = Float64(y * Float64(-0.08333333333333333 * Float64(y * Float64(x * x)))); elseif (x <= 2.8e+277) tmp = t_0; else tmp = Float64(1.0 + Float64(-0.5 * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 2.65e+20) tmp = t_0; elseif (x <= 2.8e+219) tmp = y * (-0.08333333333333333 * (y * (x * x))); elseif (x <= 2.8e+277) tmp = t_0; else tmp = 1.0 + (-0.5 * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.65e+20], t$95$0, If[LessEqual[x, 2.8e+219], N[(y * N[(-0.08333333333333333 * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.8e+277], t$95$0, N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 2.65 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+219}:\\
\;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 2.8 \cdot 10^{+277}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;1 + -0.5 \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < 2.65e20 or 2.80000000000000015e219 < x < 2.79999999999999985e277Initial program 100.0%
Taylor expanded in y around 0 79.2%
unpow279.2%
Simplified79.2%
Taylor expanded in x around 0 57.8%
+-commutative57.8%
unpow257.8%
fma-udef57.8%
Simplified57.8%
fma-udef57.8%
Applied egg-rr57.8%
if 2.65e20 < x < 2.80000000000000015e219Initial program 100.0%
Taylor expanded in y around 0 76.0%
unpow276.0%
Simplified76.0%
Taylor expanded in y around inf 27.2%
unpow227.2%
associate-*r*27.2%
*-commutative27.2%
associate-*r*27.2%
associate-*r*27.2%
*-commutative27.2%
Simplified27.2%
Taylor expanded in x around 0 20.7%
+-commutative20.7%
*-commutative20.7%
*-commutative20.7%
unpow220.7%
associate-*l*20.7%
distribute-lft-out20.7%
Simplified20.7%
Taylor expanded in x around inf 20.7%
unpow220.7%
Simplified20.7%
if 2.79999999999999985e277 < x Initial program 100.0%
Taylor expanded in y around 0 64.2%
unpow264.2%
Simplified64.2%
Taylor expanded in y around 0 22.5%
Taylor expanded in x around 0 60.6%
unpow260.6%
Simplified60.6%
Final simplification51.0%
(FPCore (x y) :precision binary64 (if (<= y 2.25) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.25) {
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.25d0) 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.25) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.25: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.25) 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.25) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.25], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.25:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2.25Initial program 100.0%
Taylor expanded in y around 0 84.7%
unpow284.7%
Simplified84.7%
Taylor expanded in x around 0 50.3%
+-commutative50.3%
unpow250.3%
fma-udef50.3%
Simplified50.3%
Taylor expanded in y around 0 41.8%
if 2.25 < y Initial program 100.0%
Taylor expanded in y around 0 58.0%
unpow258.0%
Simplified58.0%
Taylor expanded in x around 0 46.0%
+-commutative46.0%
unpow246.0%
fma-udef46.0%
Simplified46.0%
Taylor expanded in y around inf 46.0%
unpow246.0%
Simplified46.0%
Final simplification42.8%
(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.3%
unpow278.3%
Simplified78.3%
Taylor expanded in x around 0 49.3%
+-commutative49.3%
unpow249.3%
fma-udef49.3%
Simplified49.3%
Taylor expanded in y around 0 32.5%
Final simplification32.5%
herbie shell --seed 2023242
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))