
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y 0.15)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1e+77)
(/ (sinh y) y)
(if (<= y 1.35e+154)
(*
(/
(- 1.0 (* 0.027777777777777776 (pow y 4.0)))
(+ 1.0 (* (* y y) -0.16666666666666666)))
(+ 1.0 (* -0.5 (* x x))))
(* 0.16666666666666666 (* (cos x) (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 0.15) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1e+77) {
tmp = sinh(y) / y;
} else if (y <= 1.35e+154) {
tmp = ((1.0 - (0.027777777777777776 * pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.15d0) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1d+77) then
tmp = sinh(y) / y
else if (y <= 1.35d+154) then
tmp = ((1.0d0 - (0.027777777777777776d0 * (y ** 4.0d0))) / (1.0d0 + ((y * y) * (-0.16666666666666666d0)))) * (1.0d0 + ((-0.5d0) * (x * x)))
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.15) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1e+77) {
tmp = Math.sinh(y) / y;
} else if (y <= 1.35e+154) {
tmp = ((1.0 - (0.027777777777777776 * Math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (1.0 + (-0.5 * (x * x)));
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.15: tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1e+77: tmp = math.sinh(y) / y elif y <= 1.35e+154: tmp = ((1.0 - (0.027777777777777776 * math.pow(y, 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (1.0 + (-0.5 * (x * x))) else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.15) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1e+77) tmp = Float64(sinh(y) / y); elseif (y <= 1.35e+154) tmp = Float64(Float64(Float64(1.0 - Float64(0.027777777777777776 * (y ^ 4.0))) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666))) * Float64(1.0 + Float64(-0.5 * Float64(x * x)))); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.15) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1e+77) tmp = sinh(y) / y; elseif (y <= 1.35e+154) tmp = ((1.0 - (0.027777777777777776 * (y ^ 4.0))) / (1.0 + ((y * y) * -0.16666666666666666))) * (1.0 + (-0.5 * (x * x))); else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.15], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+77], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(N[(1.0 - N[(0.027777777777777776 * N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.15:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 10^{+77}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - 0.027777777777777776 \cdot {y}^{4}}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666} \cdot \left(1 + -0.5 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.149999999999999994Initial program 100.0%
Taylor expanded in y around 0 80.6%
unpow280.6%
Simplified80.6%
if 0.149999999999999994 < y < 9.99999999999999983e76Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.9%
if 9.99999999999999983e76 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 7.2%
unpow27.2%
Simplified7.2%
Taylor expanded in x around 0 21.6%
associate-+r+21.6%
+-commutative21.6%
associate-+r+21.6%
+-commutative21.6%
*-lft-identity21.6%
associate-*r*21.6%
distribute-rgt-out21.6%
+-commutative21.6%
unpow221.6%
fma-def21.6%
unpow221.6%
Simplified21.6%
fma-udef21.6%
associate-*r*21.6%
*-commutative21.6%
+-lft-identity21.6%
+-commutative21.6%
flip-+77.8%
metadata-eval77.8%
div-sub77.8%
+-lft-identity77.8%
*-commutative77.8%
associate-*r*77.8%
pow277.8%
+-lft-identity77.8%
*-commutative77.8%
associate-*r*77.8%
+-lft-identity77.8%
Applied egg-rr77.8%
div-sub77.8%
unpow277.8%
unpow277.8%
unpow277.8%
swap-sqr77.8%
metadata-eval77.8%
pow-sqr77.8%
metadata-eval77.8%
sub-neg77.8%
unpow277.8%
*-commutative77.8%
distribute-rgt-neg-in77.8%
unpow277.8%
metadata-eval77.8%
Simplified77.8%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.7%
(FPCore (x y)
:precision binary64
(if (<= y 0.085)
(cos x)
(if (<= y 1.35e+154)
(/ (sinh y) y)
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.085) {
tmp = cos(x);
} else if (y <= 1.35e+154) {
tmp = sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.085d0) then
tmp = cos(x)
else if (y <= 1.35d+154) then
tmp = sinh(y) / y
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.085) {
tmp = Math.cos(x);
} else if (y <= 1.35e+154) {
tmp = Math.sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.085: tmp = math.cos(x) elif y <= 1.35e+154: tmp = math.sinh(y) / y else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.085) tmp = cos(x); elseif (y <= 1.35e+154) tmp = Float64(sinh(y) / y); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.085) tmp = cos(x); elseif (y <= 1.35e+154) tmp = sinh(y) / y; else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.085], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.085:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.0850000000000000061Initial program 100.0%
Taylor expanded in y around 0 60.4%
if 0.0850000000000000061 < y < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.4%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification67.9%
(FPCore (x y)
:precision binary64
(if (<= y 0.185)
(* (cos x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 1.35e+154)
(/ (sinh y) y)
(* 0.16666666666666666 (* (cos x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 0.185) {
tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (cos(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.185d0) then
tmp = cos(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 1.35d+154) then
tmp = sinh(y) / y
else
tmp = 0.16666666666666666d0 * (cos(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.185) {
tmp = Math.cos(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 1.35e+154) {
tmp = Math.sinh(y) / y;
} else {
tmp = 0.16666666666666666 * (Math.cos(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.185: tmp = math.cos(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 1.35e+154: tmp = math.sinh(y) / y else: tmp = 0.16666666666666666 * (math.cos(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.185) tmp = Float64(cos(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 1.35e+154) tmp = Float64(sinh(y) / y); else tmp = Float64(0.16666666666666666 * Float64(cos(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.185) tmp = cos(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 1.35e+154) tmp = sinh(y) / y; else tmp = 0.16666666666666666 * (cos(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.185], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], N[(0.16666666666666666 * N[(N[Cos[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.185:\\
\;\;\;\;\cos x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\cos x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.185Initial program 100.0%
Taylor expanded in y around 0 80.6%
unpow280.6%
Simplified80.6%
if 0.185 < y < 1.35000000000000003e154Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 78.4%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification82.7%
(FPCore (x y)
:precision binary64
(if (<= y 0.085)
(cos x)
(if (<= y 1.9e+179)
(/ (sinh y) y)
(* (+ 1.0 (* -0.5 (* x x))) (+ 1.0 (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 0.085) {
tmp = cos(x);
} else if (y <= 1.9e+179) {
tmp = sinh(y) / y;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * (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 <= 0.085d0) then
tmp = cos(x)
else if (y <= 1.9d+179) then
tmp = sinh(y) / y
else
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.085) {
tmp = Math.cos(x);
} else if (y <= 1.9e+179) {
tmp = Math.sinh(y) / y;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.085: tmp = math.cos(x) elif y <= 1.9e+179: tmp = math.sinh(y) / y else: tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.085) tmp = cos(x); elseif (y <= 1.9e+179) tmp = Float64(sinh(y) / y); else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.085) tmp = cos(x); elseif (y <= 1.9e+179) tmp = sinh(y) / y; else tmp = (1.0 + (-0.5 * (x * x))) * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.085], N[Cos[x], $MachinePrecision], If[LessEqual[y, 1.9e+179], N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.085:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 1.9 \cdot 10^{+179}:\\
\;\;\;\;\frac{\sinh y}{y}\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.0850000000000000061Initial program 100.0%
Taylor expanded in y around 0 60.4%
if 0.0850000000000000061 < y < 1.9e179Initial program 100.0%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 76.6%
if 1.9e179 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around 0 0.0%
associate-+r+0.0%
+-commutative0.0%
associate-+r+0.0%
+-commutative0.0%
*-lft-identity0.0%
associate-*r*0.0%
distribute-rgt-out72.7%
+-commutative72.7%
unpow272.7%
fma-def72.7%
unpow272.7%
Simplified72.7%
fma-udef72.7%
Applied egg-rr72.7%
Final simplification64.4%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))) (t_1 (+ 1.0 (* -0.5 (* x x)))))
(if (<= y 11000.0)
(cos x)
(if (<= y 5.4e+76) (* t_1 (- 1.0 t_0)) (* t_1 (+ 1.0 t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = 1.0 + (-0.5 * (x * x));
double tmp;
if (y <= 11000.0) {
tmp = cos(x);
} else if (y <= 5.4e+76) {
tmp = t_1 * (1.0 - t_0);
} else {
tmp = t_1 * (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 + ((-0.5d0) * (x * x))
if (y <= 11000.0d0) then
tmp = cos(x)
else if (y <= 5.4d+76) then
tmp = t_1 * (1.0d0 - t_0)
else
tmp = t_1 * (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 + (-0.5 * (x * x));
double tmp;
if (y <= 11000.0) {
tmp = Math.cos(x);
} else if (y <= 5.4e+76) {
tmp = t_1 * (1.0 - t_0);
} else {
tmp = t_1 * (1.0 + t_0);
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) t_1 = 1.0 + (-0.5 * (x * x)) tmp = 0 if y <= 11000.0: tmp = math.cos(x) elif y <= 5.4e+76: tmp = t_1 * (1.0 - t_0) else: tmp = t_1 * (1.0 + t_0) return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) t_1 = Float64(1.0 + Float64(-0.5 * Float64(x * x))) tmp = 0.0 if (y <= 11000.0) tmp = cos(x); elseif (y <= 5.4e+76) tmp = Float64(t_1 * Float64(1.0 - t_0)); else tmp = Float64(t_1 * 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 + (-0.5 * (x * x)); tmp = 0.0; if (y <= 11000.0) tmp = cos(x); elseif (y <= 5.4e+76) tmp = t_1 * (1.0 - t_0); else tmp = t_1 * (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[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 11000.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 5.4e+76], N[(t$95$1 * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
t_1 := 1 + -0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq 11000:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 5.4 \cdot 10^{+76}:\\
\;\;\;\;t_1 \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(1 + t_0\right)\\
\end{array}
\end{array}
if y < 11000Initial program 100.0%
Taylor expanded in y around 0 60.1%
if 11000 < y < 5.3999999999999998e76Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 8.8%
associate-+r+8.8%
+-commutative8.8%
associate-+r+8.8%
+-commutative8.8%
*-lft-identity8.8%
associate-*r*8.8%
distribute-rgt-out8.8%
+-commutative8.8%
unpow28.8%
fma-def8.8%
unpow28.8%
Simplified8.8%
fma-udef8.8%
associate-*r*8.8%
*-commutative8.8%
+-lft-identity8.8%
+-commutative8.8%
flip-+8.8%
metadata-eval8.8%
div-sub8.8%
+-lft-identity8.8%
*-commutative8.8%
associate-*r*8.8%
pow28.8%
+-lft-identity8.8%
*-commutative8.8%
associate-*r*8.8%
+-lft-identity8.8%
Applied egg-rr8.8%
div-sub8.8%
unpow28.8%
unpow28.8%
unpow28.8%
swap-sqr8.8%
metadata-eval8.8%
pow-sqr8.8%
metadata-eval8.8%
sub-neg8.8%
unpow28.8%
*-commutative8.8%
distribute-rgt-neg-in8.8%
unpow28.8%
metadata-eval8.8%
Simplified8.8%
metadata-eval8.8%
*-commutative8.8%
sqr-pow8.8%
metadata-eval8.8%
pow28.8%
metadata-eval8.8%
pow28.8%
metadata-eval8.8%
swap-sqr8.8%
flip--8.8%
add-sqr-sqrt0.0%
sqrt-unprod12.8%
swap-sqr12.8%
metadata-eval12.8%
metadata-eval12.8%
swap-sqr12.8%
*-commutative12.8%
*-commutative12.8%
Applied egg-rr12.8%
if 5.3999999999999998e76 < y Initial program 100.0%
Taylor expanded in y around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in x around 0 7.7%
associate-+r+7.7%
+-commutative7.7%
associate-+r+7.7%
+-commutative7.7%
*-lft-identity7.7%
associate-*r*7.7%
distribute-rgt-out54.8%
+-commutative54.8%
unpow254.8%
fma-def54.8%
unpow254.8%
Simplified54.8%
fma-udef54.8%
Applied egg-rr54.8%
Final simplification55.9%
(FPCore (x y)
:precision binary64
(if (or (<= x 5e+99)
(and (not (<= x 4e+123))
(or (<= x 2e+162) (and (not (<= x 1.3e+244)) (<= x 1.85e+273)))))
(+ 1.0 (* 0.16666666666666666 (* y y)))
(* -0.08333333333333333 (* (* x y) (* x y)))))
double code(double x, double y) {
double tmp;
if ((x <= 5e+99) || (!(x <= 4e+123) && ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= 5d+99) .or. (.not. (x <= 4d+123)) .and. (x <= 2d+162) .or. (.not. (x <= 1.3d+244)) .and. (x <= 1.85d+273)) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (-0.08333333333333333d0) * ((x * y) * (x * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= 5e+99) || (!(x <= 4e+123) && ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))))) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= 5e+99) or (not (x <= 4e+123) and ((x <= 2e+162) or (not (x <= 1.3e+244) and (x <= 1.85e+273)))): tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = -0.08333333333333333 * ((x * y) * (x * y)) return tmp
function code(x, y) tmp = 0.0 if ((x <= 5e+99) || (!(x <= 4e+123) && ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))))) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(-0.08333333333333333 * Float64(Float64(x * y) * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= 5e+99) || (~((x <= 4e+123)) && ((x <= 2e+162) || (~((x <= 1.3e+244)) && (x <= 1.85e+273))))) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = -0.08333333333333333 * ((x * y) * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, 5e+99], And[N[Not[LessEqual[x, 4e+123]], $MachinePrecision], Or[LessEqual[x, 2e+162], And[N[Not[LessEqual[x, 1.3e+244]], $MachinePrecision], LessEqual[x, 1.85e+273]]]]], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-0.08333333333333333 * N[(N[(x * y), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{+99} \lor \neg \left(x \leq 4 \cdot 10^{+123}\right) \land \left(x \leq 2 \cdot 10^{+162} \lor \neg \left(x \leq 1.3 \cdot 10^{+244}\right) \land x \leq 1.85 \cdot 10^{+273}\right):\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(x \cdot y\right) \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if x < 5.00000000000000008e99 or 3.99999999999999991e123 < x < 1.9999999999999999e162 or 1.3e244 < x < 1.8499999999999999e273Initial program 100.0%
Taylor expanded in y around 0 73.2%
unpow273.2%
Simplified73.2%
Taylor expanded in x around 0 47.1%
+-commutative47.1%
unpow247.1%
Simplified47.1%
if 5.00000000000000008e99 < x < 3.99999999999999991e123 or 1.9999999999999999e162 < x < 1.3e244 or 1.8499999999999999e273 < x Initial program 100.0%
Taylor expanded in y around 0 63.3%
unpow263.3%
Simplified63.3%
Taylor expanded in y around inf 26.3%
unpow226.3%
*-commutative26.3%
Simplified26.3%
Taylor expanded in x around 0 12.3%
associate-*r*12.3%
distribute-rgt-out35.4%
unpow235.4%
*-commutative35.4%
fma-def35.4%
unpow235.4%
Simplified35.4%
Taylor expanded in x around inf 35.4%
unpow235.4%
unpow235.4%
*-commutative35.4%
unswap-sqr36.1%
Simplified36.1%
Final simplification46.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y)))))
(if (<= x 5e+99)
t_0
(if (<= x 4e+123)
(* -0.08333333333333333 (* (* x y) (* x y)))
(if (or (<= x 2e+162) (and (not (<= x 1.3e+244)) (<= x 1.85e+273)))
t_0
(* (* x (* y y)) (* x -0.08333333333333333)))))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (x <= 5e+99) {
tmp = t_0;
} else if (x <= 4e+123) {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
} else if ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))) {
tmp = t_0;
} else {
tmp = (x * (y * y)) * (x * -0.08333333333333333);
}
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 <= 5d+99) then
tmp = t_0
else if (x <= 4d+123) then
tmp = (-0.08333333333333333d0) * ((x * y) * (x * y))
else if ((x <= 2d+162) .or. (.not. (x <= 1.3d+244)) .and. (x <= 1.85d+273)) then
tmp = t_0
else
tmp = (x * (y * y)) * (x * (-0.08333333333333333d0))
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 <= 5e+99) {
tmp = t_0;
} else if (x <= 4e+123) {
tmp = -0.08333333333333333 * ((x * y) * (x * y));
} else if ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))) {
tmp = t_0;
} else {
tmp = (x * (y * y)) * (x * -0.08333333333333333);
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if x <= 5e+99: tmp = t_0 elif x <= 4e+123: tmp = -0.08333333333333333 * ((x * y) * (x * y)) elif (x <= 2e+162) or (not (x <= 1.3e+244) and (x <= 1.85e+273)): tmp = t_0 else: tmp = (x * (y * y)) * (x * -0.08333333333333333) return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (x <= 5e+99) tmp = t_0; elseif (x <= 4e+123) tmp = Float64(-0.08333333333333333 * Float64(Float64(x * y) * Float64(x * y))); elseif ((x <= 2e+162) || (!(x <= 1.3e+244) && (x <= 1.85e+273))) tmp = t_0; else tmp = Float64(Float64(x * Float64(y * y)) * Float64(x * -0.08333333333333333)); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + (0.16666666666666666 * (y * y)); tmp = 0.0; if (x <= 5e+99) tmp = t_0; elseif (x <= 4e+123) tmp = -0.08333333333333333 * ((x * y) * (x * y)); elseif ((x <= 2e+162) || (~((x <= 1.3e+244)) && (x <= 1.85e+273))) tmp = t_0; else tmp = (x * (y * y)) * (x * -0.08333333333333333); 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, 5e+99], t$95$0, If[LessEqual[x, 4e+123], N[(-0.08333333333333333 * N[(N[(x * y), $MachinePrecision] * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 2e+162], And[N[Not[LessEqual[x, 1.3e+244]], $MachinePrecision], LessEqual[x, 1.85e+273]]], t$95$0, N[(N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(x * -0.08333333333333333), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;x \leq 5 \cdot 10^{+99}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+123}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(\left(x \cdot y\right) \cdot \left(x \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 2 \cdot 10^{+162} \lor \neg \left(x \leq 1.3 \cdot 10^{+244}\right) \land x \leq 1.85 \cdot 10^{+273}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(y \cdot y\right)\right) \cdot \left(x \cdot -0.08333333333333333\right)\\
\end{array}
\end{array}
if x < 5.00000000000000008e99 or 3.99999999999999991e123 < x < 1.9999999999999999e162 or 1.3e244 < x < 1.8499999999999999e273Initial program 100.0%
Taylor expanded in y around 0 73.2%
unpow273.2%
Simplified73.2%
Taylor expanded in x around 0 47.1%
+-commutative47.1%
unpow247.1%
Simplified47.1%
if 5.00000000000000008e99 < x < 3.99999999999999991e123Initial program 100.0%
Taylor expanded in y around 0 52.1%
unpow252.1%
Simplified52.1%
Taylor expanded in y around inf 36.2%
unpow236.2%
*-commutative36.2%
Simplified36.2%
Taylor expanded in x around 0 17.7%
associate-*r*17.7%
distribute-rgt-out51.1%
unpow251.1%
*-commutative51.1%
fma-def51.1%
unpow251.1%
Simplified51.1%
Taylor expanded in x around inf 51.1%
unpow251.1%
unpow251.1%
*-commutative51.1%
unswap-sqr51.1%
Simplified51.1%
if 1.9999999999999999e162 < x < 1.3e244 or 1.8499999999999999e273 < x Initial program 100.0%
Taylor expanded in y around 0 66.7%
unpow266.7%
Simplified66.7%
Taylor expanded in y around inf 23.3%
unpow223.3%
*-commutative23.3%
Simplified23.3%
Taylor expanded in x around 0 10.7%
associate-*r*10.7%
distribute-rgt-out30.7%
unpow230.7%
*-commutative30.7%
fma-def30.7%
unpow230.7%
Simplified30.7%
Taylor expanded in x around inf 30.7%
*-commutative30.7%
unpow230.7%
unpow230.7%
*-commutative30.7%
associate-*r*31.7%
associate-*r*31.7%
Simplified31.7%
Final simplification46.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y)))
(t_1 (+ 1.0 t_0))
(t_2 (+ 1.0 (* -0.5 (* x x)))))
(if (<= y 8500.0) t_1 (if (<= y 5.3e+76) (* t_2 (- 1.0 t_0)) (* t_2 t_1)))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double t_1 = 1.0 + t_0;
double t_2 = 1.0 + (-0.5 * (x * x));
double tmp;
if (y <= 8500.0) {
tmp = t_1;
} else if (y <= 5.3e+76) {
tmp = t_2 * (1.0 - t_0);
} else {
tmp = t_2 * t_1;
}
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) :: t_2
real(8) :: tmp
t_0 = 0.16666666666666666d0 * (y * y)
t_1 = 1.0d0 + t_0
t_2 = 1.0d0 + ((-0.5d0) * (x * x))
if (y <= 8500.0d0) then
tmp = t_1
else if (y <= 5.3d+76) then
tmp = t_2 * (1.0d0 - t_0)
else
tmp = t_2 * t_1
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 + t_0;
double t_2 = 1.0 + (-0.5 * (x * x));
double tmp;
if (y <= 8500.0) {
tmp = t_1;
} else if (y <= 5.3e+76) {
tmp = t_2 * (1.0 - t_0);
} else {
tmp = t_2 * t_1;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) t_1 = 1.0 + t_0 t_2 = 1.0 + (-0.5 * (x * x)) tmp = 0 if y <= 8500.0: tmp = t_1 elif y <= 5.3e+76: tmp = t_2 * (1.0 - t_0) else: tmp = t_2 * t_1 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) t_1 = Float64(1.0 + t_0) t_2 = Float64(1.0 + Float64(-0.5 * Float64(x * x))) tmp = 0.0 if (y <= 8500.0) tmp = t_1; elseif (y <= 5.3e+76) tmp = Float64(t_2 * Float64(1.0 - t_0)); else tmp = Float64(t_2 * t_1); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); t_1 = 1.0 + t_0; t_2 = 1.0 + (-0.5 * (x * x)); tmp = 0.0; if (y <= 8500.0) tmp = t_1; elseif (y <= 5.3e+76) tmp = t_2 * (1.0 - t_0); else tmp = t_2 * t_1; 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[(1.0 + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 8500.0], t$95$1, If[LessEqual[y, 5.3e+76], N[(t$95$2 * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * t$95$1), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
t_1 := 1 + t_0\\
t_2 := 1 + -0.5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;y \leq 8500:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 5.3 \cdot 10^{+76}:\\
\;\;\;\;t_2 \cdot \left(1 - t_0\right)\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot t_1\\
\end{array}
\end{array}
if y < 8500Initial program 100.0%
Taylor expanded in y around 0 80.2%
unpow280.2%
Simplified80.2%
Taylor expanded in x around 0 44.0%
+-commutative44.0%
unpow244.0%
Simplified44.0%
if 8500 < y < 5.30000000000000015e76Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in x around 0 8.8%
associate-+r+8.8%
+-commutative8.8%
associate-+r+8.8%
+-commutative8.8%
*-lft-identity8.8%
associate-*r*8.8%
distribute-rgt-out8.8%
+-commutative8.8%
unpow28.8%
fma-def8.8%
unpow28.8%
Simplified8.8%
fma-udef8.8%
associate-*r*8.8%
*-commutative8.8%
+-lft-identity8.8%
+-commutative8.8%
flip-+8.8%
metadata-eval8.8%
div-sub8.8%
+-lft-identity8.8%
*-commutative8.8%
associate-*r*8.8%
pow28.8%
+-lft-identity8.8%
*-commutative8.8%
associate-*r*8.8%
+-lft-identity8.8%
Applied egg-rr8.8%
div-sub8.8%
unpow28.8%
unpow28.8%
unpow28.8%
swap-sqr8.8%
metadata-eval8.8%
pow-sqr8.8%
metadata-eval8.8%
sub-neg8.8%
unpow28.8%
*-commutative8.8%
distribute-rgt-neg-in8.8%
unpow28.8%
metadata-eval8.8%
Simplified8.8%
metadata-eval8.8%
*-commutative8.8%
sqr-pow8.8%
metadata-eval8.8%
pow28.8%
metadata-eval8.8%
pow28.8%
metadata-eval8.8%
swap-sqr8.8%
flip--8.8%
add-sqr-sqrt0.0%
sqrt-unprod12.8%
swap-sqr12.8%
metadata-eval12.8%
metadata-eval12.8%
swap-sqr12.8%
*-commutative12.8%
*-commutative12.8%
Applied egg-rr12.8%
if 5.30000000000000015e76 < y Initial program 100.0%
Taylor expanded in y around 0 65.4%
unpow265.4%
Simplified65.4%
Taylor expanded in x around 0 7.7%
associate-+r+7.7%
+-commutative7.7%
associate-+r+7.7%
+-commutative7.7%
*-lft-identity7.7%
associate-*r*7.7%
distribute-rgt-out54.8%
+-commutative54.8%
unpow254.8%
fma-def54.8%
unpow254.8%
Simplified54.8%
fma-udef54.8%
Applied egg-rr54.8%
Final simplification44.1%
(FPCore (x y) :precision binary64 (let* ((t_0 (+ 1.0 (* 0.16666666666666666 (* y y))))) (if (<= y 4.3e+20) t_0 (* (+ 1.0 (* -0.5 (* x x))) t_0))))
double code(double x, double y) {
double t_0 = 1.0 + (0.16666666666666666 * (y * y));
double tmp;
if (y <= 4.3e+20) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * 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 <= 4.3d+20) then
tmp = t_0
else
tmp = (1.0d0 + ((-0.5d0) * (x * x))) * 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 <= 4.3e+20) {
tmp = t_0;
} else {
tmp = (1.0 + (-0.5 * (x * x))) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + (0.16666666666666666 * (y * y)) tmp = 0 if y <= 4.3e+20: tmp = t_0 else: tmp = (1.0 + (-0.5 * (x * x))) * t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))) tmp = 0.0 if (y <= 4.3e+20) tmp = t_0; else tmp = Float64(Float64(1.0 + Float64(-0.5 * Float64(x * x))) * 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 <= 4.3e+20) tmp = t_0; else tmp = (1.0 + (-0.5 * (x * x))) * 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, 4.3e+20], t$95$0, N[(N[(1.0 + N[(-0.5 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 4.3 \cdot 10^{+20}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\left(1 + -0.5 \cdot \left(x \cdot x\right)\right) \cdot t_0\\
\end{array}
\end{array}
if y < 4.3e20Initial program 100.0%
Taylor expanded in y around 0 78.6%
unpow278.6%
Simplified78.6%
Taylor expanded in x around 0 43.2%
+-commutative43.2%
unpow243.2%
Simplified43.2%
if 4.3e20 < y Initial program 100.0%
Taylor expanded in y around 0 52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in x around 0 8.3%
associate-+r+8.3%
+-commutative8.3%
associate-+r+8.3%
+-commutative8.3%
*-lft-identity8.3%
associate-*r*8.3%
distribute-rgt-out45.8%
+-commutative45.8%
unpow245.8%
fma-def45.8%
unpow245.8%
Simplified45.8%
fma-udef45.8%
Applied egg-rr45.8%
Final simplification43.8%
(FPCore (x y) :precision binary64 (if (<= y 4.3e+20) (+ 1.0 (* 0.16666666666666666 (* y y))) (* y (* y (+ 0.16666666666666666 (* (* x x) -0.08333333333333333))))))
double code(double x, double y) {
double tmp;
if (y <= 4.3e+20) {
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 <= 4.3d+20) 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 <= 4.3e+20) {
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 <= 4.3e+20: 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 <= 4.3e+20) 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 <= 4.3e+20) 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[LessEqual[y, 4.3e+20], 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 4.3 \cdot 10^{+20}:\\
\;\;\;\;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 < 4.3e20Initial program 100.0%
Taylor expanded in y around 0 78.6%
unpow278.6%
Simplified78.6%
Taylor expanded in x around 0 43.2%
+-commutative43.2%
unpow243.2%
Simplified43.2%
if 4.3e20 < y Initial program 100.0%
Taylor expanded in y around 0 52.9%
unpow252.9%
Simplified52.9%
Taylor expanded in y around inf 52.9%
*-commutative52.9%
unpow252.9%
associate-*r*52.9%
associate-*l*52.9%
*-commutative52.9%
Simplified52.9%
Taylor expanded in x around 0 45.8%
*-commutative45.8%
unpow245.8%
Simplified45.8%
Final simplification43.8%
(FPCore (x y) :precision binary64 (if (<= y 8500.0) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 8500.0) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 8500.0d0) then
tmp = 1.0d0
else
tmp = 0.16666666666666666d0 * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 8500.0) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 8500.0: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 8500.0) tmp = 1.0; else tmp = Float64(0.16666666666666666 * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 8500.0) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 8500.0], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8500:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 8500Initial program 100.0%
*-commutative100.0%
associate-/r/99.9%
Simplified99.9%
Taylor expanded in x around 0 57.9%
Taylor expanded in y around 0 33.9%
if 8500 < y Initial program 100.0%
Taylor expanded in y around 0 50.0%
unpow250.0%
Simplified50.0%
Taylor expanded in y around inf 50.0%
unpow250.0%
*-commutative50.0%
Simplified50.0%
Taylor expanded in x around 0 39.1%
unpow239.1%
Simplified39.1%
Final simplification35.3%
(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 72.2%
unpow272.2%
Simplified72.2%
Taylor expanded in x around 0 42.7%
+-commutative42.7%
unpow242.7%
Simplified42.7%
Final simplification42.7%
(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%
*-commutative100.0%
associate-/r/100.0%
Simplified100.0%
Taylor expanded in x around 0 63.6%
Taylor expanded in y around 0 25.6%
Final simplification25.6%
herbie shell --seed 2023293
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))