
(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 11 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
(if (<= y -6.5e+153)
(* 0.16666666666666666 (* y (* (cos x) y)))
(if (or (<= y -2.35e+51) (and (not (<= y 2e+52)) (<= y 8.2e+147)))
(cbrt (* (pow y 6.0) 0.004629629629629629))
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= -6.5e+153) {
tmp = 0.16666666666666666 * (y * (cos(x) * y));
} else if ((y <= -2.35e+51) || (!(y <= 2e+52) && (y <= 8.2e+147))) {
tmp = cbrt((pow(y, 6.0) * 0.004629629629629629));
} else {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
public static double code(double x, double y) {
double tmp;
if (y <= -6.5e+153) {
tmp = 0.16666666666666666 * (y * (Math.cos(x) * y));
} else if ((y <= -2.35e+51) || (!(y <= 2e+52) && (y <= 8.2e+147))) {
tmp = Math.cbrt((Math.pow(y, 6.0) * 0.004629629629629629));
} else {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= -6.5e+153) tmp = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y))); elseif ((y <= -2.35e+51) || (!(y <= 2e+52) && (y <= 8.2e+147))) tmp = cbrt(Float64((y ^ 6.0) * 0.004629629629629629)); else tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
code[x_, y_] := If[LessEqual[y, -6.5e+153], N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -2.35e+51], And[N[Not[LessEqual[y, 2e+52]], $MachinePrecision], LessEqual[y, 8.2e+147]]], N[Power[N[(N[Power[y, 6.0], $MachinePrecision] * 0.004629629629629629), $MachinePrecision], 1/3], $MachinePrecision], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{+51} \lor \neg \left(y \leq 2 \cdot 10^{+52}\right) \land y \leq 8.2 \cdot 10^{+147}:\\
\;\;\;\;\sqrt[3]{{y}^{6} \cdot 0.004629629629629629}\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -6.49999999999999972e153Initial program 100.0%
Taylor expanded in y around 0 97.8%
unpow297.8%
Simplified97.8%
add-log-exp79.5%
*-un-lft-identity79.5%
log-prod79.5%
metadata-eval79.5%
add-log-exp79.5%
associate-*r*77.4%
*-commutative77.4%
Applied egg-rr95.7%
Taylor expanded in y around inf 97.8%
unpow297.8%
*-commutative97.8%
associate-*r*97.8%
Simplified97.8%
if -6.49999999999999972e153 < y < -2.3500000000000001e51 or 2e52 < y < 8.19999999999999932e147Initial program 100.0%
Taylor expanded in y around 0 5.9%
unpow25.9%
Simplified5.9%
Taylor expanded in y around inf 5.9%
unpow25.9%
Simplified5.9%
Taylor expanded in x around 0 4.2%
unpow24.2%
Simplified4.2%
add-cbrt-cube69.4%
pow369.4%
*-commutative69.4%
unpow-prod-down69.4%
pow-prod-down69.4%
pow-prod-up69.4%
metadata-eval69.4%
metadata-eval69.4%
Applied egg-rr69.4%
if -2.3500000000000001e51 < y < 2e52 or 8.19999999999999932e147 < y Initial program 100.0%
Taylor expanded in y around 0 89.6%
unpow289.6%
Simplified89.6%
Final simplification88.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y (* (cos x) y))))
(t_1
(/
(- 1.0 (* (* y y) (* (* y y) 0.027777777777777776)))
(- 1.0 (* 0.16666666666666666 (* y y))))))
(if (<= y -6.5e+153)
t_0
(if (<= y -0.0305)
t_1
(if (<= y 7.2e-6) (cos x) (if (<= y 8.2e+147) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * (cos(x) * y));
double t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - (0.16666666666666666 * (y * y)));
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= -0.0305) {
tmp = t_1;
} else if (y <= 7.2e-6) {
tmp = cos(x);
} else if (y <= 8.2e+147) {
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 = 0.16666666666666666d0 * (y * (cos(x) * y))
t_1 = (1.0d0 - ((y * y) * ((y * y) * 0.027777777777777776d0))) / (1.0d0 - (0.16666666666666666d0 * (y * y)))
if (y <= (-6.5d+153)) then
tmp = t_0
else if (y <= (-0.0305d0)) then
tmp = t_1
else if (y <= 7.2d-6) then
tmp = cos(x)
else if (y <= 8.2d+147) 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 = 0.16666666666666666 * (y * (Math.cos(x) * y));
double t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - (0.16666666666666666 * (y * y)));
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= -0.0305) {
tmp = t_1;
} else if (y <= 7.2e-6) {
tmp = Math.cos(x);
} else if (y <= 8.2e+147) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * (math.cos(x) * y)) t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - (0.16666666666666666 * (y * y))) tmp = 0 if y <= -6.5e+153: tmp = t_0 elif y <= -0.0305: tmp = t_1 elif y <= 7.2e-6: tmp = math.cos(x) elif y <= 8.2e+147: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * Float64(cos(x) * y))) t_1 = Float64(Float64(1.0 - Float64(Float64(y * y) * Float64(Float64(y * y) * 0.027777777777777776))) / Float64(1.0 - Float64(0.16666666666666666 * Float64(y * y)))) tmp = 0.0 if (y <= -6.5e+153) tmp = t_0; elseif (y <= -0.0305) tmp = t_1; elseif (y <= 7.2e-6) tmp = cos(x); elseif (y <= 8.2e+147) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * (cos(x) * y)); t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - (0.16666666666666666 * (y * y))); tmp = 0.0; if (y <= -6.5e+153) tmp = t_0; elseif (y <= -0.0305) tmp = t_1; elseif (y <= 7.2e-6) tmp = cos(x); elseif (y <= 8.2e+147) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * N[(N[Cos[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+153], t$95$0, If[LessEqual[y, -0.0305], t$95$1, If[LessEqual[y, 7.2e-6], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8.2e+147], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot \left(\cos x \cdot y\right)\right)\\
t_1 := \frac{1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)}{1 - 0.16666666666666666 \cdot \left(y \cdot y\right)}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -0.0305:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -6.49999999999999972e153 or 8.19999999999999932e147 < y Initial program 100.0%
Taylor expanded in y around 0 97.5%
unpow297.5%
Simplified97.5%
add-log-exp77.1%
*-un-lft-identity77.1%
log-prod77.1%
metadata-eval77.1%
add-log-exp77.1%
associate-*r*76.0%
*-commutative76.0%
Applied egg-rr96.3%
Taylor expanded in y around inf 97.5%
unpow297.5%
*-commutative97.5%
associate-*r*97.5%
Simplified97.5%
if -6.49999999999999972e153 < y < -0.030499999999999999 or 7.19999999999999967e-6 < y < 8.19999999999999932e147Initial program 100.0%
Taylor expanded in y around 0 7.4%
unpow27.4%
Simplified7.4%
Taylor expanded in x around 0 6.0%
+-commutative6.0%
unpow26.0%
associate-*r*6.0%
*-commutative6.0%
fma-udef6.0%
Simplified6.0%
fma-udef6.0%
+-commutative6.0%
flip-+34.3%
metadata-eval34.3%
pow234.3%
*-commutative34.3%
associate-*l*34.3%
*-commutative34.3%
associate-*l*34.3%
Applied egg-rr34.3%
unpow234.3%
associate-*r*34.3%
associate-*r*34.3%
swap-sqr34.3%
*-commutative34.3%
*-commutative34.3%
swap-sqr34.3%
metadata-eval34.3%
Applied egg-rr34.3%
if -0.030499999999999999 < y < 7.19999999999999967e-6Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
Final simplification84.9%
(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 79.1%
unpow279.1%
Simplified79.1%
Final simplification79.1%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y)))
(t_1
(/ (- 1.0 (* (* y y) (* (* y y) 0.027777777777777776))) (- 1.0 t_0))))
(if (<= y -6.5e+153)
t_0
(if (<= y -0.00021)
t_1
(if (<= y 7.2e-6) (cos x) (if (<= y 8.2e+147) t_1 (+ 1.0 t_0)))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0);
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= -0.00021) {
tmp = t_1;
} else if (y <= 7.2e-6) {
tmp = cos(x);
} else if (y <= 8.2e+147) {
tmp = t_1;
} else {
tmp = 1.0 + 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 = 0.16666666666666666d0 * (y * y)
t_1 = (1.0d0 - ((y * y) * ((y * y) * 0.027777777777777776d0))) / (1.0d0 - t_0)
if (y <= (-6.5d+153)) then
tmp = t_0
else if (y <= (-0.00021d0)) then
tmp = t_1
else if (y <= 7.2d-6) then
tmp = cos(x)
else if (y <= 8.2d+147) then
tmp = t_1
else
tmp = 1.0d0 + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0);
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= -0.00021) {
tmp = t_1;
} else if (y <= 7.2e-6) {
tmp = Math.cos(x);
} else if (y <= 8.2e+147) {
tmp = t_1;
} else {
tmp = 1.0 + t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0) tmp = 0 if y <= -6.5e+153: tmp = t_0 elif y <= -0.00021: tmp = t_1 elif y <= 7.2e-6: tmp = math.cos(x) elif y <= 8.2e+147: tmp = t_1 else: tmp = 1.0 + t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) t_1 = Float64(Float64(1.0 - Float64(Float64(y * y) * Float64(Float64(y * y) * 0.027777777777777776))) / Float64(1.0 - t_0)) tmp = 0.0 if (y <= -6.5e+153) tmp = t_0; elseif (y <= -0.00021) tmp = t_1; elseif (y <= 7.2e-6) tmp = cos(x); elseif (y <= 8.2e+147) tmp = t_1; else tmp = Float64(1.0 + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); t_1 = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0); tmp = 0.0; if (y <= -6.5e+153) tmp = t_0; elseif (y <= -0.00021) tmp = t_1; elseif (y <= 7.2e-6) tmp = cos(x); elseif (y <= 8.2e+147) tmp = t_1; else tmp = 1.0 + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(1.0 - N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+153], t$95$0, If[LessEqual[y, -0.00021], t$95$1, If[LessEqual[y, 7.2e-6], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8.2e+147], t$95$1, N[(1.0 + t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
t_1 := \frac{1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)}{1 - t_0}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -0.00021:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;1 + t_0\\
\end{array}
\end{array}
if y < -6.49999999999999972e153Initial program 100.0%
Taylor expanded in y around 0 97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in y around inf 97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in x around 0 79.5%
unpow279.5%
Simplified79.5%
if -6.49999999999999972e153 < y < -2.1000000000000001e-4 or 7.19999999999999967e-6 < y < 8.19999999999999932e147Initial program 100.0%
Taylor expanded in y around 0 7.4%
unpow27.4%
Simplified7.4%
Taylor expanded in x around 0 6.0%
+-commutative6.0%
unpow26.0%
associate-*r*6.0%
*-commutative6.0%
fma-udef6.0%
Simplified6.0%
fma-udef6.0%
+-commutative6.0%
flip-+34.3%
metadata-eval34.3%
pow234.3%
*-commutative34.3%
associate-*l*34.3%
*-commutative34.3%
associate-*l*34.3%
Applied egg-rr34.3%
unpow234.3%
associate-*r*34.3%
associate-*r*34.3%
swap-sqr34.3%
*-commutative34.3%
*-commutative34.3%
swap-sqr34.3%
metadata-eval34.3%
Applied egg-rr34.3%
if -2.1000000000000001e-4 < y < 7.19999999999999967e-6Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
if 8.19999999999999932e147 < y Initial program 100.0%
Taylor expanded in y around 0 97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in x around 0 74.2%
+-commutative74.2%
unpow274.2%
Simplified74.2%
Final simplification79.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y -6.5e+153)
t_0
(if (<= y 8.2e+147)
(/ (- 1.0 (* (* y y) (* (* y y) 0.027777777777777776))) (- 1.0 t_0))
(+ 1.0 t_0)))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= 8.2e+147) {
tmp = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0);
} else {
tmp = 1.0 + 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 = 0.16666666666666666d0 * (y * y)
if (y <= (-6.5d+153)) then
tmp = t_0
else if (y <= 8.2d+147) then
tmp = (1.0d0 - ((y * y) * ((y * y) * 0.027777777777777776d0))) / (1.0d0 - t_0)
else
tmp = 1.0d0 + t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= -6.5e+153) {
tmp = t_0;
} else if (y <= 8.2e+147) {
tmp = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0);
} else {
tmp = 1.0 + t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= -6.5e+153: tmp = t_0 elif y <= 8.2e+147: tmp = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0) else: tmp = 1.0 + t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= -6.5e+153) tmp = t_0; elseif (y <= 8.2e+147) tmp = Float64(Float64(1.0 - Float64(Float64(y * y) * Float64(Float64(y * y) * 0.027777777777777776))) / Float64(1.0 - t_0)); else tmp = Float64(1.0 + t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= -6.5e+153) tmp = t_0; elseif (y <= 8.2e+147) tmp = (1.0 - ((y * y) * ((y * y) * 0.027777777777777776))) / (1.0 - t_0); else tmp = 1.0 + t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+153], t$95$0, If[LessEqual[y, 8.2e+147], N[(N[(1.0 - N[(N[(y * y), $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(1.0 + t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+153}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+147}:\\
\;\;\;\;\frac{1 - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot 0.027777777777777776\right)}{1 - t_0}\\
\mathbf{else}:\\
\;\;\;\;1 + t_0\\
\end{array}
\end{array}
if y < -6.49999999999999972e153Initial program 100.0%
Taylor expanded in y around 0 97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in y around inf 97.8%
unpow297.8%
Simplified97.8%
Taylor expanded in x around 0 79.5%
unpow279.5%
Simplified79.5%
if -6.49999999999999972e153 < y < 8.19999999999999932e147Initial program 100.0%
Taylor expanded in y around 0 72.1%
unpow272.1%
Simplified72.1%
Taylor expanded in x around 0 39.1%
+-commutative39.1%
unpow239.1%
associate-*r*39.1%
*-commutative39.1%
fma-udef39.1%
Simplified39.1%
fma-udef39.1%
+-commutative39.1%
flip-+47.6%
metadata-eval47.6%
pow247.6%
*-commutative47.6%
associate-*l*47.6%
*-commutative47.6%
associate-*l*47.6%
Applied egg-rr47.6%
unpow247.6%
associate-*r*47.6%
associate-*r*47.6%
swap-sqr47.6%
*-commutative47.6%
*-commutative47.6%
swap-sqr47.6%
metadata-eval47.6%
Applied egg-rr47.6%
if 8.19999999999999932e147 < y Initial program 100.0%
Taylor expanded in y around 0 97.1%
unpow297.1%
Simplified97.1%
Taylor expanded in x around 0 74.2%
+-commutative74.2%
unpow274.2%
Simplified74.2%
Final simplification55.7%
(FPCore (x y) :precision binary64 (if (<= x 2.3e+157) (+ 1.0 (* 0.16666666666666666 (* y y))) (* -0.08333333333333333 (* (* y y) (* x x)))))
double code(double x, double y) {
double tmp;
if (x <= 2.3e+157) {
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 (x <= 2.3d+157) 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 (x <= 2.3e+157) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 2.3e+157: 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 (x <= 2.3e+157) 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 (x <= 2.3e+157) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((y * y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 2.3e+157], 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}\;x \leq 2.3 \cdot 10^{+157}:\\
\;\;\;\;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 x < 2.30000000000000004e157Initial program 100.0%
Taylor expanded in y around 0 78.9%
unpow278.9%
Simplified78.9%
Taylor expanded in x around 0 53.4%
+-commutative53.4%
unpow253.4%
Simplified53.4%
if 2.30000000000000004e157 < x Initial program 100.0%
Taylor expanded in y around 0 80.3%
unpow280.3%
Simplified80.3%
Taylor expanded in y around inf 28.7%
unpow228.7%
Simplified28.7%
Taylor expanded in x around 0 21.4%
fma-def21.4%
unpow221.4%
unpow221.4%
*-commutative21.4%
unpow221.4%
Simplified21.4%
Taylor expanded in x around inf 42.2%
unpow242.2%
*-commutative42.2%
unpow242.2%
Simplified42.2%
Final simplification52.4%
(FPCore (x y) :precision binary64 (if (or (<= y -2.5) (not (<= y 2.6))) (* 0.16666666666666666 (* y y)) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -2.5) || !(y <= 2.6)) {
tmp = 0.16666666666666666 * (y * y);
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-2.5d0)) .or. (.not. (y <= 2.6d0))) then
tmp = 0.16666666666666666d0 * (y * y)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -2.5) || !(y <= 2.6)) {
tmp = 0.16666666666666666 * (y * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -2.5) or not (y <= 2.6): tmp = 0.16666666666666666 * (y * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -2.5) || !(y <= 2.6)) tmp = Float64(0.16666666666666666 * Float64(y * y)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -2.5) || ~((y <= 2.6))) tmp = 0.16666666666666666 * (y * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -2.5], N[Not[LessEqual[y, 2.6]], $MachinePrecision]], N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \lor \neg \left(y \leq 2.6\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -2.5 or 2.60000000000000009 < y Initial program 100.0%
Taylor expanded in y around 0 57.3%
unpow257.3%
Simplified57.3%
Taylor expanded in y around inf 57.3%
unpow257.3%
Simplified57.3%
Taylor expanded in x around 0 45.2%
unpow245.2%
Simplified45.2%
if -2.5 < y < 2.60000000000000009Initial program 100.0%
Taylor expanded in y around 0 99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in x around 0 53.6%
+-commutative53.6%
unpow253.6%
associate-*r*53.6%
*-commutative53.6%
fma-udef53.6%
Simplified53.6%
Taylor expanded in y around 0 53.3%
Final simplification49.4%
(FPCore (x y) :precision binary64 (if (<= y -2.5) (* 0.16666666666666666 (* y y)) (if (<= y 2.6) 1.0 (* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= -2.5) {
tmp = 0.16666666666666666 * (y * y);
} else if (y <= 2.6) {
tmp = 1.0;
} else {
tmp = y * (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 <= (-2.5d0)) then
tmp = 0.16666666666666666d0 * (y * y)
else if (y <= 2.6d0) then
tmp = 1.0d0
else
tmp = y * (y * 0.16666666666666666d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.5) {
tmp = 0.16666666666666666 * (y * y);
} else if (y <= 2.6) {
tmp = 1.0;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.5: tmp = 0.16666666666666666 * (y * y) elif y <= 2.6: tmp = 1.0 else: tmp = y * (y * 0.16666666666666666) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.5) tmp = Float64(0.16666666666666666 * Float64(y * y)); elseif (y <= 2.6) tmp = 1.0; else tmp = Float64(y * Float64(y * 0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.5) tmp = 0.16666666666666666 * (y * y); elseif (y <= 2.6) tmp = 1.0; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.5], N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6], 1.0, N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq 2.6:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < -2.5Initial program 100.0%
Taylor expanded in y around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in y around inf 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in x around 0 53.1%
unpow253.1%
Simplified53.1%
if -2.5 < y < 2.60000000000000009Initial program 100.0%
Taylor expanded in y around 0 99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in x around 0 53.6%
+-commutative53.6%
unpow253.6%
associate-*r*53.6%
*-commutative53.6%
fma-udef53.6%
Simplified53.6%
Taylor expanded in y around 0 53.3%
if 2.60000000000000009 < y Initial program 100.0%
Taylor expanded in y around 0 49.6%
unpow249.6%
Simplified49.6%
Taylor expanded in y around inf 49.6%
unpow249.6%
Simplified49.6%
Taylor expanded in x around 0 37.7%
unpow237.7%
Simplified37.7%
add-log-exp68.8%
*-un-lft-identity68.8%
log-prod68.8%
metadata-eval68.8%
add-log-exp37.7%
associate-*r*37.7%
*-commutative37.7%
Applied egg-rr37.7%
Final simplification49.4%
(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 79.1%
unpow279.1%
Simplified79.1%
Taylor expanded in x around 0 49.5%
+-commutative49.5%
unpow249.5%
Simplified49.5%
Final simplification49.5%
(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 79.1%
unpow279.1%
Simplified79.1%
Taylor expanded in x around 0 49.5%
+-commutative49.5%
unpow249.5%
associate-*r*49.2%
*-commutative49.2%
fma-udef49.2%
Simplified49.2%
Taylor expanded in y around 0 28.7%
Final simplification28.7%
herbie shell --seed 2023182
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))