
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cos x) (/ (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 -1.35e+154)
(* 0.16666666666666666 (* (cos x) (* y y)))
(if (or (<= y -6e+46) (and (not (<= y 2.35e+51)) (<= y 2.25e+150)))
(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 <= -1.35e+154) {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
} else if ((y <= -6e+46) || (!(y <= 2.35e+51) && (y <= 2.25e+150))) {
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 <= -1.35e+154) {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
} else if ((y <= -6e+46) || (!(y <= 2.35e+51) && (y <= 2.25e+150))) {
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 <= -1.35e+154) tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); elseif ((y <= -6e+46) || (!(y <= 2.35e+51) && (y <= 2.25e+150))) 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, -1.35e+154], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -6e+46], And[N[Not[LessEqual[y, 2.35e+51]], $MachinePrecision], LessEqual[y, 2.25e+150]]], 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 -1.35 \cdot 10^{+154}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq -6 \cdot 10^{+46} \lor \neg \left(y \leq 2.35 \cdot 10^{+51}\right) \land y \leq 2.25 \cdot 10^{+150}:\\
\;\;\;\;\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 < -1.35000000000000003e154Initial 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%
if -1.35000000000000003e154 < y < -6.00000000000000047e46 or 2.3500000000000001e51 < y < 2.25e150Initial program 100.0%
Taylor expanded in y around 0 6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in x around 0 5.7%
+-commutative5.7%
unpow25.7%
associate-*r*5.7%
*-commutative5.7%
fma-udef5.7%
Simplified5.7%
Taylor expanded in y around inf 5.7%
unpow25.7%
Simplified5.7%
add-cbrt-cube83.0%
pow383.0%
*-commutative83.0%
unpow-prod-down83.0%
pow-prod-down83.0%
pow-prod-up83.0%
metadata-eval83.0%
metadata-eval83.0%
Applied egg-rr83.0%
if -6.00000000000000047e46 < y < 2.3500000000000001e51 or 2.25e150 < y Initial program 100.0%
Taylor expanded in y around 0 88.5%
unpow288.5%
Simplified88.5%
Final simplification88.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* (cos x) (* y y))))
(t_1 (* (pow x 4.0) (* (* y y) 0.006944444444444444))))
(if (<= y -1.3e+152)
t_0
(if (<= y -5e+37)
t_1
(if (<= y 5e+17) (cos x) (if (<= y 3.4e+147) t_1 t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (cos(x) * (y * y));
double t_1 = pow(x, 4.0) * ((y * y) * 0.006944444444444444);
double tmp;
if (y <= -1.3e+152) {
tmp = t_0;
} else if (y <= -5e+37) {
tmp = t_1;
} else if (y <= 5e+17) {
tmp = cos(x);
} else if (y <= 3.4e+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 * (cos(x) * (y * y))
t_1 = (x ** 4.0d0) * ((y * y) * 0.006944444444444444d0)
if (y <= (-1.3d+152)) then
tmp = t_0
else if (y <= (-5d+37)) then
tmp = t_1
else if (y <= 5d+17) then
tmp = cos(x)
else if (y <= 3.4d+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 * (Math.cos(x) * (y * y));
double t_1 = Math.pow(x, 4.0) * ((y * y) * 0.006944444444444444);
double tmp;
if (y <= -1.3e+152) {
tmp = t_0;
} else if (y <= -5e+37) {
tmp = t_1;
} else if (y <= 5e+17) {
tmp = Math.cos(x);
} else if (y <= 3.4e+147) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.cos(x) * (y * y)) t_1 = math.pow(x, 4.0) * ((y * y) * 0.006944444444444444) tmp = 0 if y <= -1.3e+152: tmp = t_0 elif y <= -5e+37: tmp = t_1 elif y <= 5e+17: tmp = math.cos(x) elif y <= 3.4e+147: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))) t_1 = Float64((x ^ 4.0) * Float64(Float64(y * y) * 0.006944444444444444)) tmp = 0.0 if (y <= -1.3e+152) tmp = t_0; elseif (y <= -5e+37) tmp = t_1; elseif (y <= 5e+17) tmp = cos(x); elseif (y <= 3.4e+147) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (cos(x) * (y * y)); t_1 = (x ^ 4.0) * ((y * y) * 0.006944444444444444); tmp = 0.0; if (y <= -1.3e+152) tmp = t_0; elseif (y <= -5e+37) tmp = t_1; elseif (y <= 5e+17) tmp = cos(x); elseif (y <= 3.4e+147) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[x, 4.0], $MachinePrecision] * N[(N[(y * y), $MachinePrecision] * 0.006944444444444444), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.3e+152], t$95$0, If[LessEqual[y, -5e+37], t$95$1, If[LessEqual[y, 5e+17], N[Cos[x], $MachinePrecision], If[LessEqual[y, 3.4e+147], t$95$1, t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
t_1 := {x}^{4} \cdot \left(\left(y \cdot y\right) \cdot 0.006944444444444444\right)\\
\mathbf{if}\;y \leq -1.3 \cdot 10^{+152}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -5 \cdot 10^{+37}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5 \cdot 10^{+17}:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{+147}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.3e152 or 3.4e147 < y Initial program 100.0%
Taylor expanded in y around 0 92.9%
unpow292.9%
Simplified92.9%
Taylor expanded in y around inf 92.9%
unpow292.9%
Simplified92.9%
if -1.3e152 < y < -4.99999999999999989e37 or 5e17 < y < 3.4e147Initial program 100.0%
Taylor expanded in y around 0 5.4%
unpow25.4%
Simplified5.4%
Taylor expanded in y around inf 5.4%
unpow25.4%
Simplified5.4%
Taylor expanded in x around 0 4.6%
associate-+r+4.6%
+-commutative4.6%
unpow24.6%
*-commutative4.6%
associate-*r*4.6%
*-commutative4.6%
associate-*r*4.6%
distribute-rgt-out16.9%
unpow216.9%
unpow216.9%
Simplified16.9%
Taylor expanded in x around inf 35.8%
unpow235.8%
associate-*r*35.8%
metadata-eval35.8%
swap-sqr35.8%
*-commutative35.8%
swap-sqr35.8%
metadata-eval35.8%
Simplified35.8%
if -4.99999999999999989e37 < y < 5e17Initial program 100.0%
Taylor expanded in y around 0 93.6%
unpow293.6%
Simplified93.6%
Taylor expanded in y around 0 93.3%
Final simplification82.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* (cos x) (* y y)))))
(if (<= y -1.1e+149)
t_0
(if (<= y -600.0)
(* y (* y (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))
(if (<= y 2.45) (cos x) t_0)))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (cos(x) * (y * y));
double tmp;
if (y <= -1.1e+149) {
tmp = t_0;
} else if (y <= -600.0) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} else if (y <= 2.45) {
tmp = cos(x);
} 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 = 0.16666666666666666d0 * (cos(x) * (y * y))
if (y <= (-1.1d+149)) then
tmp = t_0
else if (y <= (-600.0d0)) then
tmp = y * (y * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0))))
else if (y <= 2.45d0) then
tmp = cos(x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 0.16666666666666666 * (Math.cos(x) * (y * y));
double tmp;
if (y <= -1.1e+149) {
tmp = t_0;
} else if (y <= -600.0) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} else if (y <= 2.45) {
tmp = Math.cos(x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (math.cos(x) * (y * y)) tmp = 0 if y <= -1.1e+149: tmp = t_0 elif y <= -600.0: tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))) elif y <= 2.45: tmp = math.cos(x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))) tmp = 0.0 if (y <= -1.1e+149) tmp = t_0; elseif (y <= -600.0) tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333)))); elseif (y <= 2.45) tmp = cos(x); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (cos(x) * (y * y)); tmp = 0.0; if (y <= -1.1e+149) tmp = t_0; elseif (y <= -600.0) tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))); elseif (y <= 2.45) tmp = cos(x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.1e+149], t$95$0, If[LessEqual[y, -600.0], N[(y * N[(y * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.45], N[Cos[x], $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\mathbf{if}\;y \leq -1.1 \cdot 10^{+149}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -600:\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{elif}\;y \leq 2.45:\\
\;\;\;\;\cos x\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if y < -1.1e149 or 2.4500000000000002 < y Initial program 100.0%
Taylor expanded in y around 0 65.0%
unpow265.0%
Simplified65.0%
Taylor expanded in y around inf 65.0%
unpow265.0%
Simplified65.0%
if -1.1e149 < y < -600Initial program 100.0%
Taylor expanded in y around 0 5.2%
unpow25.2%
Simplified5.2%
Taylor expanded in y around inf 5.2%
unpow25.2%
*-commutative5.2%
associate-*l*5.2%
associate-*r*5.2%
*-commutative5.2%
associate-*l*5.2%
Simplified5.2%
Taylor expanded in x around 0 22.9%
*-commutative22.9%
associate-*l*22.9%
*-commutative22.9%
distribute-lft-out22.9%
unpow222.9%
Simplified22.9%
if -600 < y < 2.4500000000000002Initial program 100.0%
Taylor expanded in y around 0 99.5%
unpow299.5%
Simplified99.5%
Taylor expanded in y around 0 99.1%
Final simplification78.4%
(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 76.6%
unpow276.6%
Simplified76.6%
Final simplification76.6%
(FPCore (x y) :precision binary64 (if (or (<= y -550.0) (not (<= y 1.02e+37))) (* y (* y (+ 0.16666666666666666 (* (* x x) -0.08333333333333333)))) (cos x)))
double code(double x, double y) {
double tmp;
if ((y <= -550.0) || !(y <= 1.02e+37)) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} else {
tmp = cos(x);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= (-550.0d0)) .or. (.not. (y <= 1.02d+37))) then
tmp = y * (y * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0))))
else
tmp = cos(x)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= -550.0) || !(y <= 1.02e+37)) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} else {
tmp = Math.cos(x);
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -550.0) or not (y <= 1.02e+37): tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))) else: tmp = math.cos(x) return tmp
function code(x, y) tmp = 0.0 if ((y <= -550.0) || !(y <= 1.02e+37)) tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333)))); else tmp = cos(x); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= -550.0) || ~((y <= 1.02e+37))) tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))); else tmp = cos(x); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -550.0], N[Not[LessEqual[y, 1.02e+37]], $MachinePrecision]], N[(y * N[(y * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cos[x], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -550 \lor \neg \left(y \leq 1.02 \cdot 10^{+37}\right):\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos x\\
\end{array}
\end{array}
if y < -550 or 1.01999999999999995e37 < y Initial program 100.0%
Taylor expanded in y around 0 53.0%
unpow253.0%
Simplified53.0%
Taylor expanded in y around inf 53.0%
unpow253.0%
*-commutative53.0%
associate-*l*52.2%
associate-*r*52.2%
*-commutative52.2%
associate-*l*52.2%
Simplified52.2%
Taylor expanded in x around 0 46.3%
*-commutative46.3%
associate-*l*46.3%
*-commutative46.3%
distribute-lft-out46.3%
unpow246.3%
Simplified46.3%
if -550 < y < 1.01999999999999995e37Initial program 100.0%
Taylor expanded in y around 0 95.5%
unpow295.5%
Simplified95.5%
Taylor expanded in y around 0 95.2%
Final simplification73.4%
(FPCore (x y) :precision binary64 (if (or (<= y -11000.0) (not (<= y 1.02e+37))) (* y (* y (+ 0.16666666666666666 (* (* x x) -0.08333333333333333)))) (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if ((y <= -11000.0) || !(y <= 1.02e+37)) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} 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 <= (-11000.0d0)) .or. (.not. (y <= 1.02d+37))) then
tmp = y * (y * (0.16666666666666666d0 + ((x * x) * (-0.08333333333333333d0))))
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 <= -11000.0) || !(y <= 1.02e+37)) {
tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333)));
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -11000.0) or not (y <= 1.02e+37): tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if ((y <= -11000.0) || !(y <= 1.02e+37)) tmp = Float64(y * Float64(y * Float64(0.16666666666666666 + Float64(Float64(x * x) * -0.08333333333333333)))); 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 <= -11000.0) || ~((y <= 1.02e+37))) tmp = y * (y * (0.16666666666666666 + ((x * x) * -0.08333333333333333))); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -11000.0], N[Not[LessEqual[y, 1.02e+37]], $MachinePrecision]], N[(y * N[(y * N[(0.16666666666666666 + N[(N[(x * x), $MachinePrecision] * -0.08333333333333333), $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 -11000 \lor \neg \left(y \leq 1.02 \cdot 10^{+37}\right):\\
\;\;\;\;y \cdot \left(y \cdot \left(0.16666666666666666 + \left(x \cdot x\right) \cdot -0.08333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < -11000 or 1.01999999999999995e37 < y Initial program 100.0%
Taylor expanded in y around 0 53.4%
unpow253.4%
Simplified53.4%
Taylor expanded in y around inf 53.4%
unpow253.4%
*-commutative53.4%
associate-*l*52.7%
associate-*r*52.7%
*-commutative52.7%
associate-*l*52.7%
Simplified52.7%
Taylor expanded in x around 0 46.7%
*-commutative46.7%
associate-*l*46.7%
*-commutative46.7%
distribute-lft-out46.7%
unpow246.7%
Simplified46.7%
if -11000 < y < 1.01999999999999995e37Initial program 100.0%
Taylor expanded in y around 0 94.9%
unpow294.9%
Simplified94.9%
Taylor expanded in x around 0 57.1%
+-commutative57.1%
unpow257.1%
Simplified57.1%
Final simplification52.5%
(FPCore (x y) :precision binary64 (if (<= x -4.2e+141) (* -0.08333333333333333 (* (* y y) (* x x))) (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if (x <= -4.2e+141) {
tmp = -0.08333333333333333 * ((y * y) * (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 (x <= (-4.2d+141)) then
tmp = (-0.08333333333333333d0) * ((y * y) * (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 (x <= -4.2e+141) {
tmp = -0.08333333333333333 * ((y * y) * (x * x));
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.2e+141: tmp = -0.08333333333333333 * ((y * y) * (x * x)) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.2e+141) tmp = Float64(-0.08333333333333333 * Float64(Float64(y * y) * 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 (x <= -4.2e+141) tmp = -0.08333333333333333 * ((y * y) * (x * x)); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.2e+141], N[(-0.08333333333333333 * N[(N[(y * y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+141}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if x < -4.1999999999999997e141Initial program 100.0%
Taylor expanded in y around 0 83.7%
unpow283.7%
Simplified83.7%
Taylor expanded in y around inf 43.8%
unpow243.8%
*-commutative43.8%
associate-*l*40.9%
associate-*r*40.9%
*-commutative40.9%
associate-*l*40.9%
Simplified40.9%
Taylor expanded in x around 0 38.6%
*-commutative38.6%
associate-*l*38.6%
*-commutative38.6%
distribute-lft-out38.6%
unpow238.6%
Simplified38.6%
Taylor expanded in x around inf 38.1%
unpow238.1%
unpow238.1%
*-commutative38.1%
Simplified38.1%
if -4.1999999999999997e141 < x Initial program 100.0%
Taylor expanded in y around 0 75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
unpow251.9%
Simplified51.9%
Final simplification50.3%
(FPCore (x y) :precision binary64 (if (<= x -4.2e+141) (* y (* -0.08333333333333333 (* y (* x x)))) (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
double tmp;
if (x <= -4.2e+141) {
tmp = y * (-0.08333333333333333 * (y * (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 (x <= (-4.2d+141)) then
tmp = y * ((-0.08333333333333333d0) * (y * (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 (x <= -4.2e+141) {
tmp = y * (-0.08333333333333333 * (y * (x * x)));
} else {
tmp = 1.0 + (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.2e+141: tmp = y * (-0.08333333333333333 * (y * (x * x))) else: tmp = 1.0 + (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (x <= -4.2e+141) tmp = Float64(y * Float64(-0.08333333333333333 * Float64(y * 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 (x <= -4.2e+141) tmp = y * (-0.08333333333333333 * (y * (x * x))); else tmp = 1.0 + (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.2e+141], N[(y * N[(-0.08333333333333333 * N[(y * 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}\;x \leq -4.2 \cdot 10^{+141}:\\
\;\;\;\;y \cdot \left(-0.08333333333333333 \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if x < -4.1999999999999997e141Initial program 100.0%
Taylor expanded in y around 0 83.7%
unpow283.7%
Simplified83.7%
Taylor expanded in y around inf 43.8%
unpow243.8%
*-commutative43.8%
associate-*l*40.9%
associate-*r*40.9%
*-commutative40.9%
associate-*l*40.9%
Simplified40.9%
Taylor expanded in x around 0 38.6%
*-commutative38.6%
associate-*l*38.6%
*-commutative38.6%
distribute-lft-out38.6%
unpow238.6%
Simplified38.6%
Taylor expanded in x around inf 38.6%
unpow238.6%
Simplified38.6%
if -4.1999999999999997e141 < x Initial program 100.0%
Taylor expanded in y around 0 75.6%
unpow275.6%
Simplified75.6%
Taylor expanded in x around 0 51.9%
+-commutative51.9%
unpow251.9%
Simplified51.9%
Final simplification50.4%
(FPCore (x y) :precision binary64 (if (or (<= y -9e+16) (not (<= y 2.45))) (* 0.16666666666666666 (* y y)) 1.0))
double code(double x, double y) {
double tmp;
if ((y <= -9e+16) || !(y <= 2.45)) {
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 <= (-9d+16)) .or. (.not. (y <= 2.45d0))) 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 <= -9e+16) || !(y <= 2.45)) {
tmp = 0.16666666666666666 * (y * y);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= -9e+16) or not (y <= 2.45): tmp = 0.16666666666666666 * (y * y) else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if ((y <= -9e+16) || !(y <= 2.45)) 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 <= -9e+16) || ~((y <= 2.45))) tmp = 0.16666666666666666 * (y * y); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, -9e+16], N[Not[LessEqual[y, 2.45]], $MachinePrecision]], N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+16} \lor \neg \left(y \leq 2.45\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if y < -9e16 or 2.4500000000000002 < y Initial program 100.0%
Taylor expanded in y around 0 51.4%
unpow251.4%
Simplified51.4%
Taylor expanded in x around 0 34.8%
+-commutative34.8%
unpow234.8%
associate-*r*34.8%
*-commutative34.8%
fma-udef34.8%
Simplified34.8%
Taylor expanded in y around inf 34.8%
unpow234.8%
Simplified34.8%
if -9e16 < y < 2.4500000000000002Initial program 100.0%
Taylor expanded in y around 0 98.1%
unpow298.1%
Simplified98.1%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
unpow259.0%
associate-*r*59.0%
*-commutative59.0%
fma-udef59.0%
Simplified59.0%
Taylor expanded in y around 0 58.6%
Final simplification47.6%
(FPCore (x y) :precision binary64 (if (<= y -9e+16) (* 0.16666666666666666 (* y y)) (if (<= y 2.6) 1.0 (* y (* y 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if (y <= -9e+16) {
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 <= (-9d+16)) 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 <= -9e+16) {
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 <= -9e+16: 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 <= -9e+16) 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 <= -9e+16) 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, -9e+16], 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 -9 \cdot 10^{+16}:\\
\;\;\;\;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 < -9e16Initial program 100.0%
Taylor expanded in y around 0 49.9%
unpow249.9%
Simplified49.9%
Taylor expanded in x around 0 38.9%
+-commutative38.9%
unpow238.9%
associate-*r*38.9%
*-commutative38.9%
fma-udef38.9%
Simplified38.9%
Taylor expanded in y around inf 38.9%
unpow238.9%
Simplified38.9%
if -9e16 < y < 2.60000000000000009Initial program 100.0%
Taylor expanded in y around 0 98.1%
unpow298.1%
Simplified98.1%
Taylor expanded in x around 0 59.0%
+-commutative59.0%
unpow259.0%
associate-*r*59.0%
*-commutative59.0%
fma-udef59.0%
Simplified59.0%
Taylor expanded in y around 0 58.6%
if 2.60000000000000009 < y Initial program 100.0%
Taylor expanded in y around 0 52.8%
unpow252.8%
Simplified52.8%
Taylor expanded in y around inf 52.8%
unpow252.8%
*-commutative52.8%
associate-*l*51.4%
associate-*r*51.4%
*-commutative51.4%
associate-*l*51.4%
Simplified51.4%
Taylor expanded in x around 0 30.9%
Final simplification47.6%
(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 76.6%
unpow276.6%
Simplified76.6%
Taylor expanded in x around 0 47.8%
+-commutative47.8%
unpow247.8%
Simplified47.8%
Final simplification47.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 76.6%
unpow276.6%
Simplified76.6%
Taylor expanded in x around 0 47.8%
+-commutative47.8%
unpow247.8%
associate-*r*47.8%
*-commutative47.8%
fma-udef47.8%
Simplified47.8%
Taylor expanded in y around 0 32.8%
Final simplification32.8%
herbie shell --seed 2023185
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))