
(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 10 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}
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (* (cos x) (/ (expm1 (log1p (sinh y))) y)))
y = abs(y);
double code(double x, double y) {
return cos(x) * (expm1(log1p(sinh(y))) / y);
}
y = Math.abs(y);
public static double code(double x, double y) {
return Math.cos(x) * (Math.expm1(Math.log1p(Math.sinh(y))) / y);
}
y = abs(y) def code(x, y): return math.cos(x) * (math.expm1(math.log1p(math.sinh(y))) / y)
y = abs(y) function code(x, y) return Float64(cos(x) * Float64(expm1(log1p(sinh(y))) / y)) end
NOTE: y should be positive before calling this function code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[(Exp[N[Log[1 + N[Sinh[y], $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\cos x \cdot \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\sinh y\right)\right)}{y}
\end{array}
Initial program 100.0%
expm1-log1p-u77.3%
Applied egg-rr77.3%
Final simplification77.3%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (* (cos x) (/ (sinh y) y)))
y = abs(y);
double code(double x, double y) {
return cos(x) * (sinh(y) / y);
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = cos(x) * (sinh(y) / y)
end function
y = Math.abs(y);
public static double code(double x, double y) {
return Math.cos(x) * (Math.sinh(y) / y);
}
y = abs(y) def code(x, y): return math.cos(x) * (math.sinh(y) / y)
y = abs(y) function code(x, y) return Float64(cos(x) * Float64(sinh(y) / y)) end
y = abs(y) function tmp = code(x, y) tmp = cos(x) * (sinh(y) / y); end
NOTE: y should be positive before calling this function code[x_, y_] := N[(N[Cos[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
\cos x \cdot \frac{\sinh y}{y}
\end{array}
Initial program 100.0%
Final simplification100.0%
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= y 640.0)
(cos x)
(if (<= y 8e+125)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* y (* (cos x) (* y 0.16666666666666666))))))y = abs(y);
double code(double x, double y) {
double tmp;
if (y <= 640.0) {
tmp = cos(x);
} else if (y <= 8e+125) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 640.0d0) then
tmp = cos(x)
else if (y <= 8d+125) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (y <= 640.0) {
tmp = Math.cos(x);
} else if (y <= 8e+125) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if y <= 640.0: tmp = math.cos(x) elif y <= 8e+125: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if (y <= 640.0) tmp = cos(x); elseif (y <= 8e+125) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (y <= 640.0) tmp = cos(x); elseif (y <= 8e+125) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[y, 640.0], N[Cos[x], $MachinePrecision], If[LessEqual[y, 8e+125], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 640:\\
\;\;\;\;\cos x\\
\mathbf{elif}\;y \leq 8 \cdot 10^{+125}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 640Initial program 100.0%
Taylor expanded in y around 0 70.2%
if 640 < y < 7.9999999999999994e125Initial program 100.0%
Taylor expanded in y around 0 4.5%
associate-*r*4.5%
distribute-rgt1-in4.5%
fma-def4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
unpow23.1%
associate-*r*3.1%
Simplified4.5%
Taylor expanded in x around 0 36.5%
+-commutative36.5%
unpow236.5%
unpow236.5%
associate-*r*36.5%
distribute-rgt-out36.5%
unpow236.5%
Simplified36.5%
if 7.9999999999999994e125 < y Initial program 100.0%
Taylor expanded in y around 0 88.9%
associate-*r*88.9%
distribute-rgt1-in88.9%
fma-def88.9%
unpow288.9%
Simplified88.9%
Taylor expanded in y around inf 88.9%
unpow266.9%
associate-*r*66.9%
Simplified88.9%
Taylor expanded in y around 0 88.9%
unpow288.9%
associate-*r*88.9%
associate-*r*88.9%
*-commutative88.9%
associate-*r*88.9%
Simplified88.9%
Final simplification69.8%
NOTE: y should be positive before calling this function
(FPCore (x y)
:precision binary64
(if (<= y 540.0)
(* (cos x) (+ (* 0.16666666666666666 (* y y)) 1.0))
(if (<= y 6.8e+125)
(* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))
(* y (* (cos x) (* y 0.16666666666666666))))))y = abs(y);
double code(double x, double y) {
double tmp;
if (y <= 540.0) {
tmp = cos(x) * ((0.16666666666666666 * (y * y)) + 1.0);
} else if (y <= 6.8e+125) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = y * (cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 540.0d0) then
tmp = cos(x) * ((0.16666666666666666d0 * (y * y)) + 1.0d0)
else if (y <= 6.8d+125) then
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
else
tmp = y * (cos(x) * (y * 0.16666666666666666d0))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (y <= 540.0) {
tmp = Math.cos(x) * ((0.16666666666666666 * (y * y)) + 1.0);
} else if (y <= 6.8e+125) {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
} else {
tmp = y * (Math.cos(x) * (y * 0.16666666666666666));
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if y <= 540.0: tmp = math.cos(x) * ((0.16666666666666666 * (y * y)) + 1.0) elif y <= 6.8e+125: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) else: tmp = y * (math.cos(x) * (y * 0.16666666666666666)) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if (y <= 540.0) tmp = Float64(cos(x) * Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0)); elseif (y <= 6.8e+125) tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); else tmp = Float64(y * Float64(cos(x) * Float64(y * 0.16666666666666666))); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (y <= 540.0) tmp = cos(x) * ((0.16666666666666666 * (y * y)) + 1.0); elseif (y <= 6.8e+125) tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); else tmp = y * (cos(x) * (y * 0.16666666666666666)); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[y, 540.0], N[(N[Cos[x], $MachinePrecision] * N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 6.8e+125], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[Cos[x], $MachinePrecision] * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 540:\\
\;\;\;\;\cos x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right) + 1\right)\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{+125}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(0.16666666666666666 + -0.08333333333333333 \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(\cos x \cdot \left(y \cdot 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if y < 540Initial program 100.0%
Taylor expanded in y around 0 86.5%
associate-*r*86.5%
distribute-rgt1-in86.5%
fma-def86.5%
unpow286.5%
Simplified86.5%
fma-udef86.5%
Applied egg-rr86.5%
if 540 < y < 6.7999999999999998e125Initial program 100.0%
Taylor expanded in y around 0 4.5%
associate-*r*4.5%
distribute-rgt1-in4.5%
fma-def4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
unpow23.1%
associate-*r*3.1%
Simplified4.5%
Taylor expanded in x around 0 36.5%
+-commutative36.5%
unpow236.5%
unpow236.5%
associate-*r*36.5%
distribute-rgt-out36.5%
unpow236.5%
Simplified36.5%
if 6.7999999999999998e125 < y Initial program 100.0%
Taylor expanded in y around 0 88.9%
associate-*r*88.9%
distribute-rgt1-in88.9%
fma-def88.9%
unpow288.9%
Simplified88.9%
Taylor expanded in y around inf 88.9%
unpow266.9%
associate-*r*66.9%
Simplified88.9%
Taylor expanded in y around 0 88.9%
unpow288.9%
associate-*r*88.9%
associate-*r*88.9%
*-commutative88.9%
associate-*r*88.9%
Simplified88.9%
Final simplification81.8%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= y 52000.0) (cos x) (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
y = abs(y);
double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = cos(x);
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 52000.0d0) then
tmp = cos(x)
else
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (y <= 52000.0) {
tmp = Math.cos(x);
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if y <= 52000.0: tmp = math.cos(x) else: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if (y <= 52000.0) tmp = cos(x); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (y <= 52000.0) tmp = cos(x); else tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[y, 52000.0], N[Cos[x], $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 52000:\\
\;\;\;\;\cos x\\
\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 < 52000Initial program 100.0%
Taylor expanded in y around 0 70.2%
if 52000 < y Initial program 100.0%
Taylor expanded in y around 0 56.1%
associate-*r*56.1%
distribute-rgt1-in56.1%
fma-def56.1%
unpow256.1%
Simplified56.1%
Taylor expanded in y around inf 56.1%
unpow242.1%
associate-*r*42.1%
Simplified56.1%
Taylor expanded in x around 0 14.6%
+-commutative14.6%
unpow214.6%
unpow214.6%
associate-*r*14.6%
distribute-rgt-out59.4%
unpow259.4%
Simplified59.4%
Final simplification67.4%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (or (<= y 7.3) (not (<= y 8e+125))) (+ (* 0.16666666666666666 (* y y)) 1.0) (* -0.08333333333333333 (* y (* y (* x x))))))
y = abs(y);
double code(double x, double y) {
double tmp;
if ((y <= 7.3) || !(y <= 8e+125)) {
tmp = (0.16666666666666666 * (y * y)) + 1.0;
} else {
tmp = -0.08333333333333333 * (y * (y * (x * x)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((y <= 7.3d0) .or. (.not. (y <= 8d+125))) then
tmp = (0.16666666666666666d0 * (y * y)) + 1.0d0
else
tmp = (-0.08333333333333333d0) * (y * (y * (x * x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if ((y <= 7.3) || !(y <= 8e+125)) {
tmp = (0.16666666666666666 * (y * y)) + 1.0;
} else {
tmp = -0.08333333333333333 * (y * (y * (x * x)));
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if (y <= 7.3) or not (y <= 8e+125): tmp = (0.16666666666666666 * (y * y)) + 1.0 else: tmp = -0.08333333333333333 * (y * (y * (x * x))) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if ((y <= 7.3) || !(y <= 8e+125)) tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0); else tmp = Float64(-0.08333333333333333 * Float64(y * Float64(y * Float64(x * x)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 7.3) || ~((y <= 8e+125))) tmp = (0.16666666666666666 * (y * y)) + 1.0; else tmp = -0.08333333333333333 * (y * (y * (x * x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[Or[LessEqual[y, 7.3], N[Not[LessEqual[y, 8e+125]], $MachinePrecision]], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(-0.08333333333333333 * N[(y * N[(y * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.3 \lor \neg \left(y \leq 8 \cdot 10^{+125}\right):\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right) + 1\\
\mathbf{else}:\\
\;\;\;\;-0.08333333333333333 \cdot \left(y \cdot \left(y \cdot \left(x \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if y < 7.29999999999999982 or 7.9999999999999994e125 < y Initial program 100.0%
Taylor expanded in y around 0 87.0%
associate-*r*87.0%
distribute-rgt1-in87.0%
fma-def87.0%
unpow287.0%
Simplified87.0%
fma-udef87.0%
Applied egg-rr87.0%
Taylor expanded in x around 0 55.7%
+-commutative55.7%
unpow255.7%
Simplified55.7%
if 7.29999999999999982 < y < 7.9999999999999994e125Initial program 100.0%
Taylor expanded in y around 0 4.5%
associate-*r*4.5%
distribute-rgt1-in4.5%
fma-def4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in y around inf 4.5%
unpow23.1%
associate-*r*3.1%
Simplified4.5%
Taylor expanded in x around 0 36.5%
+-commutative36.5%
unpow236.5%
unpow236.5%
associate-*r*36.5%
distribute-rgt-out36.5%
unpow236.5%
Simplified36.5%
Taylor expanded in x around inf 35.1%
unpow235.1%
unpow235.1%
*-commutative35.1%
associate-*l*35.1%
Simplified35.1%
Final simplification53.6%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= y 7.3) (+ (* 0.16666666666666666 (* y y)) 1.0) (* (* y y) (+ 0.16666666666666666 (* -0.08333333333333333 (* x x))))))
y = abs(y);
double code(double x, double y) {
double tmp;
if (y <= 7.3) {
tmp = (0.16666666666666666 * (y * y)) + 1.0;
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 7.3d0) then
tmp = (0.16666666666666666d0 * (y * y)) + 1.0d0
else
tmp = (y * y) * (0.16666666666666666d0 + ((-0.08333333333333333d0) * (x * x)))
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (y <= 7.3) {
tmp = (0.16666666666666666 * (y * y)) + 1.0;
} else {
tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x)));
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if y <= 7.3: tmp = (0.16666666666666666 * (y * y)) + 1.0 else: tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if (y <= 7.3) tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0); else tmp = Float64(Float64(y * y) * Float64(0.16666666666666666 + Float64(-0.08333333333333333 * Float64(x * x)))); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (y <= 7.3) tmp = (0.16666666666666666 * (y * y)) + 1.0; else tmp = (y * y) * (0.16666666666666666 + (-0.08333333333333333 * (x * x))); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[y, 7.3], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(0.16666666666666666 + N[(-0.08333333333333333 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 7.3:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot y\right) + 1\\
\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 < 7.29999999999999982Initial program 100.0%
Taylor expanded in y around 0 86.5%
associate-*r*86.5%
distribute-rgt1-in86.5%
fma-def86.5%
unpow286.5%
Simplified86.5%
fma-udef86.5%
Applied egg-rr86.5%
Taylor expanded in x around 0 53.2%
+-commutative53.2%
unpow253.2%
Simplified53.2%
if 7.29999999999999982 < y Initial program 100.0%
Taylor expanded in y around 0 56.1%
associate-*r*56.1%
distribute-rgt1-in56.1%
fma-def56.1%
unpow256.1%
Simplified56.1%
Taylor expanded in y around inf 56.1%
unpow242.1%
associate-*r*42.1%
Simplified56.1%
Taylor expanded in x around 0 14.6%
+-commutative14.6%
unpow214.6%
unpow214.6%
associate-*r*14.6%
distribute-rgt-out59.4%
unpow259.4%
Simplified59.4%
Final simplification54.8%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (if (<= y 10200000000000.0) 1.0 (* y (* y 0.16666666666666666))))
y = abs(y);
double code(double x, double y) {
double tmp;
if (y <= 10200000000000.0) {
tmp = 1.0;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 10200000000000.0d0) then
tmp = 1.0d0
else
tmp = y * (y * 0.16666666666666666d0)
end if
code = tmp
end function
y = Math.abs(y);
public static double code(double x, double y) {
double tmp;
if (y <= 10200000000000.0) {
tmp = 1.0;
} else {
tmp = y * (y * 0.16666666666666666);
}
return tmp;
}
y = abs(y) def code(x, y): tmp = 0 if y <= 10200000000000.0: tmp = 1.0 else: tmp = y * (y * 0.16666666666666666) return tmp
y = abs(y) function code(x, y) tmp = 0.0 if (y <= 10200000000000.0) tmp = 1.0; else tmp = Float64(y * Float64(y * 0.16666666666666666)); end return tmp end
y = abs(y) function tmp_2 = code(x, y) tmp = 0.0; if (y <= 10200000000000.0) tmp = 1.0; else tmp = y * (y * 0.16666666666666666); end tmp_2 = tmp; end
NOTE: y should be positive before calling this function code[x_, y_] := If[LessEqual[y, 10200000000000.0], 1.0, N[(y * N[(y * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y = |y|\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 10200000000000:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(y \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 1.02e13Initial program 100.0%
Taylor expanded in y around 0 85.7%
associate-*r*85.7%
distribute-rgt1-in85.7%
fma-def85.7%
unpow285.7%
Simplified85.7%
fma-udef85.7%
Applied egg-rr85.7%
Taylor expanded in x around 0 52.7%
+-commutative52.7%
unpow252.7%
fma-def52.7%
Simplified52.7%
Taylor expanded in y around 0 40.2%
if 1.02e13 < y Initial program 100.0%
Taylor expanded in y around 0 57.8%
associate-*r*57.8%
distribute-rgt1-in57.8%
fma-def57.8%
unpow257.8%
Simplified57.8%
fma-udef57.8%
Applied egg-rr57.8%
Taylor expanded in x around 0 43.4%
+-commutative43.4%
unpow243.4%
fma-def43.4%
Simplified43.4%
Taylor expanded in y around inf 43.4%
unpow243.4%
associate-*r*43.4%
Simplified43.4%
Final simplification41.0%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 (+ (* 0.16666666666666666 (* y y)) 1.0))
y = abs(y);
double code(double x, double y) {
return (0.16666666666666666 * (y * y)) + 1.0;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (0.16666666666666666d0 * (y * y)) + 1.0d0
end function
y = Math.abs(y);
public static double code(double x, double y) {
return (0.16666666666666666 * (y * y)) + 1.0;
}
y = abs(y) def code(x, y): return (0.16666666666666666 * (y * y)) + 1.0
y = abs(y) function code(x, y) return Float64(Float64(0.16666666666666666 * Float64(y * y)) + 1.0) end
y = abs(y) function tmp = code(x, y) tmp = (0.16666666666666666 * (y * y)) + 1.0; end
NOTE: y should be positive before calling this function code[x_, y_] := N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]
\begin{array}{l}
y = |y|\\
\\
0.16666666666666666 \cdot \left(y \cdot y\right) + 1
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 78.6%
associate-*r*78.6%
distribute-rgt1-in78.6%
fma-def78.6%
unpow278.6%
Simplified78.6%
fma-udef78.6%
Applied egg-rr78.6%
Taylor expanded in x around 0 50.3%
+-commutative50.3%
unpow250.3%
Simplified50.3%
Final simplification50.3%
NOTE: y should be positive before calling this function (FPCore (x y) :precision binary64 1.0)
y = abs(y);
double code(double x, double y) {
return 1.0;
}
NOTE: y should be positive before calling this function
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
y = Math.abs(y);
public static double code(double x, double y) {
return 1.0;
}
y = abs(y) def code(x, y): return 1.0
y = abs(y) function code(x, y) return 1.0 end
y = abs(y) function tmp = code(x, y) tmp = 1.0; end
NOTE: y should be positive before calling this function code[x_, y_] := 1.0
\begin{array}{l}
y = |y|\\
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 78.6%
associate-*r*78.6%
distribute-rgt1-in78.6%
fma-def78.6%
unpow278.6%
Simplified78.6%
fma-udef78.6%
Applied egg-rr78.6%
Taylor expanded in x around 0 50.3%
+-commutative50.3%
unpow250.3%
fma-def50.3%
Simplified50.3%
Taylor expanded in y around 0 30.6%
Final simplification30.6%
herbie shell --seed 2023271
(FPCore (x y)
:name "Linear.Quaternion:$csin from linear-1.19.1.3"
:precision binary64
(* (cos x) (/ (sinh y) y)))