
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.cos(x) * (math.sinh(y) / y)
function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 580.0)
(* (cos x) (+ 1.0 t_0))
(if (<= y 8.2e+102)
(* (+ 1.0 (* x (* x -0.5))) (fma 0.16666666666666666 (* y y) 1.0))
(if (<= y 1.35e+154)
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y))
(* (cos x) t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 580.0) {
tmp = cos(x) * (1.0 + t_0);
} else if (y <= 8.2e+102) {
tmp = (1.0 + (x * (x * -0.5))) * fma(0.16666666666666666, (y * y), 1.0);
} else if (y <= 1.35e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = cos(x) * t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 580.0) tmp = Float64(cos(x) * Float64(1.0 + t_0)); elseif (y <= 8.2e+102) tmp = Float64(Float64(1.0 + Float64(x * Float64(x * -0.5))) * fma(0.16666666666666666, Float64(y * y), 1.0)); elseif (y <= 1.35e+154) tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); else tmp = Float64(cos(x) * t_0); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 580.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+102], N[(N[(1.0 + N[(x * N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.16666666666666666 * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 580:\\
\;\;\;\;\cos x \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\left(1 + x \cdot \left(x \cdot -0.5\right)\right) \cdot \mathsf{fma}\left(0.16666666666666666, y \cdot y, 1\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot t_0\\
\end{array}
\end{array}
if y < 580Initial program 100.0%
Taylor expanded in y around 0 82.9%
unpow282.9%
Simplified82.9%
if 580 < y < 8.1999999999999999e102Initial program 100.0%
Taylor expanded in y around 0 4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around 0 43.7%
+-commutative43.7%
associate-+r+43.7%
*-commutative43.7%
associate-*r*43.7%
distribute-rgt1-in43.7%
*-commutative43.7%
unpow243.7%
associate-*l*43.7%
+-commutative43.7%
fma-def43.7%
unpow243.7%
Simplified43.7%
if 8.1999999999999999e102 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in x around 0 90.9%
rec-exp90.9%
Simplified90.9%
Taylor expanded in y around 0 90.9%
unpow390.9%
unpow290.9%
associate-*r*90.9%
distribute-rgt-out90.9%
*-commutative90.9%
fma-def90.9%
unpow290.9%
Simplified90.9%
*-un-lft-identity90.9%
*-commutative90.9%
metadata-eval90.9%
metadata-eval90.9%
pow-prod-up90.9%
pow190.9%
inv-pow90.9%
associate-*l*90.9%
*-commutative90.9%
*-commutative90.9%
associate-/r/90.9%
clear-num90.9%
div-inv90.9%
*-commutative90.9%
associate-*l*90.9%
pow190.9%
inv-pow90.9%
pow-prod-up90.9%
metadata-eval90.9%
metadata-eval90.9%
*-commutative90.9%
*-un-lft-identity90.9%
fma-udef90.9%
associate-*l*90.9%
fma-def90.9%
Applied egg-rr90.9%
remove-double-div90.9%
fma-udef90.9%
Applied egg-rr90.9%
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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification81.4%
(FPCore (x y)
:precision binary64
(if (<= y 23.0)
(cos x)
(if (<= y 8.2e+102)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(if (<= y 4.5e+154)
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y))
(* y (* y (* (cos x) 0.16666666666666666)))))))
double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = cos(x);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 4.5e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = y * (y * (cos(x) * 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 <= 23.0d0) then
tmp = cos(x)
else if (y <= 8.2d+102) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else if (y <= 4.5d+154) then
tmp = 0.5d0 * ((y * ((y * (y * 0.3333333333333333d0)) + 2.0d0)) / y)
else
tmp = y * (y * (cos(x) * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = Math.cos(x);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 4.5e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = y * (y * (Math.cos(x) * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 23.0: tmp = math.cos(x) elif y <= 8.2e+102: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) elif y <= 4.5e+154: tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y) else: tmp = y * (y * (math.cos(x) * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if (y <= 23.0) tmp = cos(x); elseif (y <= 8.2e+102) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); elseif (y <= 4.5e+154) tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); else tmp = Float64(y * Float64(y * Float64(cos(x) * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 23.0) tmp = cos(x); elseif (y <= 8.2e+102) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); elseif (y <= 4.5e+154) tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y); else tmp = y * (y * (cos(x) * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 23.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8.2e+102], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+154], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(y * N[(y * N[(N[Cos[x], $MachinePrecision] * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 23:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot \left(\cos x \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 23Initial program 100.0%
Taylor expanded in y around 0 66.5%
if 23 < y < 8.1999999999999999e102Initial program 100.0%
Taylor expanded in y around 0 4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
associate-*r*4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around 0 42.4%
unpow242.4%
Simplified42.4%
if 8.1999999999999999e102 < y < 4.50000000000000009e154Initial program 100.0%
Taylor expanded in x around 0 91.7%
rec-exp91.7%
Simplified91.7%
Taylor expanded in y around 0 91.7%
unpow391.7%
unpow291.7%
associate-*r*91.7%
distribute-rgt-out91.7%
*-commutative91.7%
fma-def91.7%
unpow291.7%
Simplified91.7%
*-un-lft-identity91.7%
*-commutative91.7%
metadata-eval91.7%
metadata-eval91.7%
pow-prod-up91.7%
pow191.7%
inv-pow91.7%
associate-*l*91.7%
*-commutative91.7%
*-commutative91.7%
associate-/r/91.7%
clear-num91.7%
div-inv91.7%
*-commutative91.7%
associate-*l*91.7%
pow191.7%
inv-pow91.7%
pow-prod-up91.7%
metadata-eval91.7%
metadata-eval91.7%
*-commutative91.7%
*-un-lft-identity91.7%
fma-udef91.7%
associate-*l*91.7%
fma-def91.7%
Applied egg-rr91.7%
remove-double-div91.7%
fma-udef91.7%
Applied egg-rr91.7%
if 4.50000000000000009e154 < 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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in x around inf 100.0%
*-commutative100.0%
*-commutative100.0%
associate-*r*100.0%
unpow2100.0%
associate-*l*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification68.8%
(FPCore (x y)
:precision binary64
(if (<= y 23.0)
(cos x)
(if (<= y 8.2e+102)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(if (<= y 1.35e+154)
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y))
(* (cos x) (* 0.16666666666666666 (* y y)))))))
double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = cos(x);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 1.35e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = cos(x) * (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 <= 23.0d0) then
tmp = cos(x)
else if (y <= 8.2d+102) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else if (y <= 1.35d+154) then
tmp = 0.5d0 * ((y * ((y * (y * 0.3333333333333333d0)) + 2.0d0)) / y)
else
tmp = cos(x) * (0.16666666666666666d0 * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = Math.cos(x);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 1.35e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = Math.cos(x) * (0.16666666666666666 * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 23.0: tmp = math.cos(x) elif y <= 8.2e+102: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) elif y <= 1.35e+154: tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y) else: tmp = math.cos(x) * (0.16666666666666666 * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 23.0) tmp = cos(x); elseif (y <= 8.2e+102) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); elseif (y <= 1.35e+154) tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); else tmp = Float64(cos(x) * Float64(0.16666666666666666 * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 23.0) tmp = cos(x); elseif (y <= 8.2e+102) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); elseif (y <= 1.35e+154) tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y); else tmp = cos(x) * (0.16666666666666666 * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 23.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8.2e+102], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[Cos[x], $MachinePrecision] * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 23:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 23Initial program 100.0%
Taylor expanded in y around 0 66.5%
if 23 < y < 8.1999999999999999e102Initial program 100.0%
Taylor expanded in y around 0 4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
associate-*r*4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around 0 42.4%
unpow242.4%
Simplified42.4%
if 8.1999999999999999e102 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in x around 0 90.9%
rec-exp90.9%
Simplified90.9%
Taylor expanded in y around 0 90.9%
unpow390.9%
unpow290.9%
associate-*r*90.9%
distribute-rgt-out90.9%
*-commutative90.9%
fma-def90.9%
unpow290.9%
Simplified90.9%
*-un-lft-identity90.9%
*-commutative90.9%
metadata-eval90.9%
metadata-eval90.9%
pow-prod-up90.9%
pow190.9%
inv-pow90.9%
associate-*l*90.9%
*-commutative90.9%
*-commutative90.9%
associate-/r/90.9%
clear-num90.9%
div-inv90.9%
*-commutative90.9%
associate-*l*90.9%
pow190.9%
inv-pow90.9%
pow-prod-up90.9%
metadata-eval90.9%
metadata-eval90.9%
*-commutative90.9%
*-un-lft-identity90.9%
fma-udef90.9%
associate-*l*90.9%
fma-def90.9%
Applied egg-rr90.9%
remove-double-div90.9%
fma-udef90.9%
Applied egg-rr90.9%
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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification68.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 520.0)
(* (cos x) (+ 1.0 t_0))
(if (<= y 8.2e+102)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(if (<= y 1.35e+154)
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y))
(* (cos x) t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 520.0) {
tmp = cos(x) * (1.0 + t_0);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 1.35e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = cos(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 = 0.16666666666666666d0 * (y * y)
if (y <= 520.0d0) then
tmp = cos(x) * (1.0d0 + t_0)
else if (y <= 8.2d+102) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else if (y <= 1.35d+154) then
tmp = 0.5d0 * ((y * ((y * (y * 0.3333333333333333d0)) + 2.0d0)) / y)
else
tmp = cos(x) * 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 <= 520.0) {
tmp = Math.cos(x) * (1.0 + t_0);
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else if (y <= 1.35e+154) {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
} else {
tmp = Math.cos(x) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 520.0: tmp = math.cos(x) * (1.0 + t_0) elif y <= 8.2e+102: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) elif y <= 1.35e+154: tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y) else: tmp = math.cos(x) * t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 520.0) tmp = Float64(cos(x) * Float64(1.0 + t_0)); elseif (y <= 8.2e+102) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); elseif (y <= 1.35e+154) tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); else tmp = Float64(cos(x) * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 520.0) tmp = cos(x) * (1.0 + t_0); elseif (y <= 8.2e+102) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); elseif (y <= 1.35e+154) tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y); else tmp = cos(x) * 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, 520.0], N[(N[Cos[x], $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+102], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[Cos[x], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{if}\;y \leq 520:\\
\;\;\;\;\cos x \cdot \left(1 + t_0\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot t_0\\
\end{array}
\end{array}
if y < 520Initial program 100.0%
Taylor expanded in y around 0 82.9%
unpow282.9%
Simplified82.9%
if 520 < y < 8.1999999999999999e102Initial program 100.0%
Taylor expanded in y around 0 4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in y around inf 4.2%
*-commutative4.2%
associate-*r*4.2%
*-commutative4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around inf 4.2%
*-commutative4.2%
associate-*r*4.2%
*-commutative4.2%
associate-*r*4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around 0 43.7%
unpow243.7%
Simplified43.7%
if 8.1999999999999999e102 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in x around 0 90.9%
rec-exp90.9%
Simplified90.9%
Taylor expanded in y around 0 90.9%
unpow390.9%
unpow290.9%
associate-*r*90.9%
distribute-rgt-out90.9%
*-commutative90.9%
fma-def90.9%
unpow290.9%
Simplified90.9%
*-un-lft-identity90.9%
*-commutative90.9%
metadata-eval90.9%
metadata-eval90.9%
pow-prod-up90.9%
pow190.9%
inv-pow90.9%
associate-*l*90.9%
*-commutative90.9%
*-commutative90.9%
associate-/r/90.9%
clear-num90.9%
div-inv90.9%
*-commutative90.9%
associate-*l*90.9%
pow190.9%
inv-pow90.9%
pow-prod-up90.9%
metadata-eval90.9%
metadata-eval90.9%
*-commutative90.9%
*-un-lft-identity90.9%
fma-udef90.9%
associate-*l*90.9%
fma-def90.9%
Applied egg-rr90.9%
remove-double-div90.9%
fma-udef90.9%
Applied egg-rr90.9%
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%
*-commutative100.0%
associate-*r*100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification81.4%
(FPCore (x y)
:precision binary64
(if (<= y 23.0)
(cos x)
(if (<= y 8.5e+102)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y)))))
double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = cos(x);
} else if (y <= 8.5e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 23.0d0) then
tmp = cos(x)
else if (y <= 8.5d+102) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else
tmp = 0.5d0 * ((y * ((y * (y * 0.3333333333333333d0)) + 2.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 23.0) {
tmp = Math.cos(x);
} else if (y <= 8.5e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 23.0: tmp = math.cos(x) elif y <= 8.5e+102: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 23.0) tmp = cos(x); elseif (y <= 8.5e+102) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); else tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 23.0) tmp = cos(x); elseif (y <= 8.5e+102) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 23.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8.5e+102], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 23:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+102}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\end{array}
\end{array}
if y < 23Initial program 100.0%
Taylor expanded in y around 0 66.5%
if 23 < y < 8.4999999999999996e102Initial program 100.0%
Taylor expanded in y around 0 4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around inf 4.5%
*-commutative4.5%
associate-*r*4.5%
*-commutative4.5%
associate-*r*4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around 0 42.4%
unpow242.4%
Simplified42.4%
if 8.4999999999999996e102 < y Initial program 100.0%
Taylor expanded in x around 0 81.6%
rec-exp81.6%
Simplified81.6%
Taylor expanded in y around 0 81.6%
unpow381.6%
unpow281.6%
associate-*r*81.6%
distribute-rgt-out81.6%
*-commutative81.6%
fma-def81.6%
unpow281.6%
Simplified81.6%
*-un-lft-identity81.6%
*-commutative81.6%
metadata-eval81.6%
metadata-eval81.6%
pow-prod-up81.6%
pow181.6%
inv-pow81.6%
associate-*l*81.6%
*-commutative81.6%
*-commutative81.6%
associate-/r/81.6%
clear-num81.6%
div-inv81.6%
*-commutative81.6%
associate-*l*81.6%
pow181.6%
inv-pow81.6%
pow-prod-up81.6%
metadata-eval81.6%
metadata-eval81.6%
*-commutative81.6%
*-un-lft-identity81.6%
fma-udef81.6%
associate-*l*81.6%
fma-def81.6%
Applied egg-rr81.6%
remove-double-div81.6%
fma-udef81.6%
Applied egg-rr81.6%
Final simplification66.4%
(FPCore (x y)
:precision binary64
(if (<= y 250.0)
(+ 1.0 (* 0.16666666666666666 (* y y)))
(if (<= y 8.2e+102)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* 0.5 (/ (* y (+ (* y (* y 0.3333333333333333)) 2.0)) y)))))
double code(double x, double y) {
double tmp;
if (y <= 250.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 250.0d0) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else if (y <= 8.2d+102) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else
tmp = 0.5d0 * ((y * ((y * (y * 0.3333333333333333d0)) + 2.0d0)) / y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 250.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else if (y <= 8.2e+102) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 250.0: tmp = 1.0 + (0.16666666666666666 * (y * y)) elif y <= 8.2e+102: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y) return tmp
function code(x, y) tmp = 0.0 if (y <= 250.0) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); elseif (y <= 8.2e+102) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); else tmp = Float64(0.5 * Float64(Float64(y * Float64(Float64(y * Float64(y * 0.3333333333333333)) + 2.0)) / y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 250.0) tmp = 1.0 + (0.16666666666666666 * (y * y)); elseif (y <= 8.2e+102) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = 0.5 * ((y * ((y * (y * 0.3333333333333333)) + 2.0)) / y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 250.0], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.2e+102], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(N[(y * N[(N[(y * N[(y * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] + 2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 250:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{elif}\;y \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \frac{y \cdot \left(y \cdot \left(y \cdot 0.3333333333333333\right) + 2\right)}{y}\\
\end{array}
\end{array}
if y < 250Initial program 100.0%
Taylor expanded in y around 0 82.9%
unpow282.9%
Simplified82.9%
Taylor expanded in x around 0 47.8%
unpow247.8%
Simplified47.8%
if 250 < y < 8.1999999999999999e102Initial program 100.0%
Taylor expanded in y around 0 4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in y around inf 4.2%
*-commutative4.2%
associate-*r*4.2%
*-commutative4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around inf 4.2%
*-commutative4.2%
associate-*r*4.2%
*-commutative4.2%
associate-*r*4.2%
unpow24.2%
Simplified4.2%
Taylor expanded in x around 0 43.7%
unpow243.7%
Simplified43.7%
if 8.1999999999999999e102 < y Initial program 100.0%
Taylor expanded in x around 0 81.6%
rec-exp81.6%
Simplified81.6%
Taylor expanded in y around 0 81.6%
unpow381.6%
unpow281.6%
associate-*r*81.6%
distribute-rgt-out81.6%
*-commutative81.6%
fma-def81.6%
unpow281.6%
Simplified81.6%
*-un-lft-identity81.6%
*-commutative81.6%
metadata-eval81.6%
metadata-eval81.6%
pow-prod-up81.6%
pow181.6%
inv-pow81.6%
associate-*l*81.6%
*-commutative81.6%
*-commutative81.6%
associate-/r/81.6%
clear-num81.6%
div-inv81.6%
*-commutative81.6%
associate-*l*81.6%
pow181.6%
inv-pow81.6%
pow-prod-up81.6%
metadata-eval81.6%
metadata-eval81.6%
*-commutative81.6%
*-un-lft-identity81.6%
fma-udef81.6%
associate-*l*81.6%
fma-def81.6%
Applied egg-rr81.6%
remove-double-div81.6%
fma-udef81.6%
Applied egg-rr81.6%
Final simplification52.4%
(FPCore (x y) :precision binary64 (if (<= y 78.0) (+ 1.0 (* 0.16666666666666666 (* y y))) (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
double code(double x, double y) {
double tmp;
if (y <= 78.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 78.0d0) then
tmp = 1.0d0 + (0.16666666666666666d0 * (y * y))
else
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 78.0) {
tmp = 1.0 + (0.16666666666666666 * (y * y));
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 78.0: tmp = 1.0 + (0.16666666666666666 * (y * y)) else: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) return tmp
function code(x, y) tmp = 0.0 if (y <= 78.0) tmp = Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y))); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 78.0) tmp = 1.0 + (0.16666666666666666 * (y * y)); else tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 78.0], N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 78:\\
\;\;\;\;1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if y < 78Initial program 100.0%
Taylor expanded in y around 0 82.9%
unpow282.9%
Simplified82.9%
Taylor expanded in x around 0 47.8%
unpow247.8%
Simplified47.8%
if 78 < y Initial program 100.0%
Taylor expanded in y around 0 46.5%
unpow246.5%
Simplified46.5%
Taylor expanded in y around inf 46.5%
*-commutative46.5%
associate-*r*46.5%
*-commutative46.5%
unpow246.5%
Simplified46.5%
Taylor expanded in x around inf 46.5%
*-commutative46.5%
associate-*r*46.5%
*-commutative46.5%
associate-*r*46.5%
unpow246.5%
Simplified46.5%
Taylor expanded in x around 0 51.6%
unpow251.6%
Simplified51.6%
Final simplification48.7%
(FPCore (x y) :precision binary64 (if (<= y 2.65) 1.0 (* y (* y 0.16666666666666666))))
double code(double x, double y) {
double tmp;
if (y <= 2.65) {
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.65d0) 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.65) {
tmp = 1.0;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.65: tmp = 1.0 else: tmp = y * (y * 0.16666666666666666) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.65) 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.65) tmp = 1.0; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.65], 1.0, N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.65:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 2.64999999999999991Initial program 100.0%
Taylor expanded in x around 0 28.2%
rec-exp28.2%
Simplified28.2%
Taylor expanded in y around 0 35.0%
if 2.64999999999999991 < y Initial program 100.0%
Taylor expanded in y around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in y around inf 46.0%
*-commutative46.0%
associate-*r*46.0%
*-commutative46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in x around 0 35.6%
*-commutative35.6%
unpow235.6%
associate-*r*34.3%
Simplified34.3%
Final simplification34.8%
(FPCore (x y) :precision binary64 (if (<= y 2.5) 1.0 (* 0.16666666666666666 (* y y))))
double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.5d0) then
tmp = 1.0d0
else
tmp = 0.16666666666666666d0 * (y * y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.5) {
tmp = 1.0;
} else {
tmp = 0.16666666666666666 * (y * y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.5: tmp = 1.0 else: tmp = 0.16666666666666666 * (y * y) return tmp
function code(x, y) tmp = 0.0 if (y <= 2.5) tmp = 1.0; else tmp = Float64(0.16666666666666666 * Float64(y * y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.5) tmp = 1.0; else tmp = 0.16666666666666666 * (y * y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.5], 1.0, N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.5:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right)\\
\end{array}
\end{array}
if y < 2.5Initial program 100.0%
Taylor expanded in x around 0 28.2%
rec-exp28.2%
Simplified28.2%
Taylor expanded in y around 0 35.0%
if 2.5 < y Initial program 100.0%
Taylor expanded in y around 0 46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in y around inf 46.0%
*-commutative46.0%
associate-*r*46.0%
*-commutative46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in x around inf 46.0%
*-commutative46.0%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
unpow246.0%
Simplified46.0%
Taylor expanded in x around 0 35.6%
Final simplification35.1%
(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 74.1%
unpow274.1%
Simplified74.1%
Taylor expanded in x around 0 44.9%
unpow244.9%
Simplified44.9%
Final simplification44.9%
(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 x around 0 38.4%
rec-exp38.5%
Simplified38.5%
Taylor expanded in y around 0 27.0%
Final simplification27.0%
herbie shell --seed 2023230
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))