
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (* (sin x) (/ (sinh y) y)))
double code(double x, double y) {
return sin(x) * (sinh(y) / y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (sinh(y) / y)
end function
public static double code(double x, double y) {
return Math.sin(x) * (Math.sinh(y) / y);
}
def code(x, y): return math.sin(x) * (math.sinh(y) / y)
function code(x, y) return Float64(sin(x) * Float64(sinh(y) / y)) end
function tmp = code(x, y) tmp = sin(x) * (sinh(y) / y); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \frac{\sinh y}{y}
\end{array}
(FPCore (x y) :precision binary64 (* (/ (sinh y) y) (sin x)))
double code(double x, double y) {
return (sinh(y) / y) * sin(x);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (sinh(y) / y) * sin(x)
end function
public static double code(double x, double y) {
return (Math.sinh(y) / y) * Math.sin(x);
}
def code(x, y): return (math.sinh(y) / y) * math.sin(x)
function code(x, y) return Float64(Float64(sinh(y) / y) * sin(x)) end
function tmp = code(x, y) tmp = (sinh(y) / y) * sin(x); end
code[x_, y_] := N[(N[(N[Sinh[y], $MachinePrecision] / y), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sinh y}{y} \cdot \sin x
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(*
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0)
(sin x))
(if (<= y 1.8e+47)
(/ 1.0 (/ (/ y x) (sinh y)))
(* (* (pow y 6.0) 0.0001984126984126984) (sin x)))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0) * sin(x);
} else if (y <= 1.8e+47) {
tmp = 1.0 / ((y / x) / sinh(y));
} else {
tmp = (pow(y, 6.0) * 0.0001984126984126984) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * sin(x)); elseif (y <= 1.8e+47) tmp = Float64(1.0 / Float64(Float64(y / x) / sinh(y))); else tmp = Float64(Float64((y ^ 6.0) * 0.0001984126984126984) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+47], N[(1.0 / N[(N[(y / x), $MachinePrecision] / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[y, 6.0], $MachinePrecision] * 0.0001984126984126984), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{1}{\frac{\frac{y}{x}}{\sinh y}}\\
\mathbf{else}:\\
\;\;\;\;\left({y}^{6} \cdot 0.0001984126984126984\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6490.7
Applied rewrites90.7%
if 0.52000000000000002 < y < 1.80000000000000004e47Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6482.6
Applied rewrites82.6%
if 1.80000000000000004e47 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.1
Applied rewrites98.1%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification92.3%
(FPCore (x y)
:precision binary64
(if (<= (sin x) 1e-5)
(*
(fma
(*
(fma
(fma (* x x) -0.0001984126984126984 0.008333333333333333)
(* x x)
-0.16666666666666666)
(* x x))
x
x)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0))
(fma
(* (* x x) x)
(fma (* x x) 0.008333333333333333 -0.16666666666666666)
x)))
double code(double x, double y) {
double tmp;
if (sin(x) <= 1e-5) {
tmp = fma((fma(fma((x * x), -0.0001984126984126984, 0.008333333333333333), (x * x), -0.16666666666666666) * (x * x)), x, x) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
} else {
tmp = fma(((x * x) * x), fma((x * x), 0.008333333333333333, -0.16666666666666666), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (sin(x) <= 1e-5) tmp = Float64(fma(Float64(fma(fma(Float64(x * x), -0.0001984126984126984, 0.008333333333333333), Float64(x * x), -0.16666666666666666) * Float64(x * x)), x, x) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); else tmp = fma(Float64(Float64(x * x) * x), fma(Float64(x * x), 0.008333333333333333, -0.16666666666666666), x); end return tmp end
code[x_, y_] := If[LessEqual[N[Sin[x], $MachinePrecision], 1e-5], N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin x \leq 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.0001984126984126984, 0.008333333333333333\right), x \cdot x, -0.16666666666666666\right) \cdot \left(x \cdot x\right), x, x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, 0.008333333333333333, -0.16666666666666666\right), x\right)\\
\end{array}
\end{array}
if (sin.f64 x) < 1.00000000000000008e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites72.1%
Applied rewrites72.1%
if 1.00000000000000008e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6440.1
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites23.6%
Applied rewrites23.6%
(FPCore (x y)
:precision binary64
(if (<= (sin x) 1e-5)
(*
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(fma
(* (* x x) x)
(fma (* x x) 0.008333333333333333 -0.16666666666666666)
x)))
double code(double x, double y) {
double tmp;
if (sin(x) <= 1e-5) {
tmp = fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma(((x * x) * x), fma((x * x), 0.008333333333333333, -0.16666666666666666), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (sin(x) <= 1e-5) tmp = Float64(fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = fma(Float64(Float64(x * x) * x), fma(Float64(x * x), 0.008333333333333333, -0.16666666666666666), x); end return tmp end
code[x_, y_] := If[LessEqual[N[Sin[x], $MachinePrecision], 1e-5], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin x \leq 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, 0.008333333333333333, -0.16666666666666666\right), x\right)\\
\end{array}
\end{array}
if (sin.f64 x) < 1.00000000000000008e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval72.1
Applied rewrites72.1%
Applied rewrites72.1%
Applied rewrites72.1%
if 1.00000000000000008e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6440.1
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites23.6%
Applied rewrites23.6%
Final simplification62.0%
(FPCore (x y)
:precision binary64
(let* ((t_0
(*
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0)
(sin x))))
(if (<= y 0.52) t_0 (if (<= y 9.8e+51) (/ 1.0 (/ (/ y x) (sinh y))) t_0))))
double code(double x, double y) {
double t_0 = fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0) * sin(x);
double tmp;
if (y <= 0.52) {
tmp = t_0;
} else if (y <= 9.8e+51) {
tmp = 1.0 / ((y / x) / sinh(y));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, y) t_0 = Float64(fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * sin(x)) tmp = 0.0 if (y <= 0.52) tmp = t_0; elseif (y <= 9.8e+51) tmp = Float64(1.0 / Float64(Float64(y / x) / sinh(y))); else tmp = t_0; end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 0.52], t$95$0, If[LessEqual[y, 9.8e+51], N[(1.0 / N[(N[(y / x), $MachinePrecision] / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \sin x\\
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 9.8 \cdot 10^{+51}:\\
\;\;\;\;\frac{1}{\frac{\frac{y}{x}}{\sinh y}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < 0.52000000000000002 or 9.79999999999999967e51 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6492.5
Applied rewrites92.5%
if 0.52000000000000002 < y < 9.79999999999999967e51Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6484.8
Applied rewrites84.8%
Final simplification92.3%
(FPCore (x y)
:precision binary64
(if (<= (sin x) 1e-5)
(*
(fma (fma 0.008333333333333333 (* y y) 0.16666666666666666) (* y y) 1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(fma
(* (* x x) x)
(fma (* x x) 0.008333333333333333 -0.16666666666666666)
x)))
double code(double x, double y) {
double tmp;
if (sin(x) <= 1e-5) {
tmp = fma(fma(0.008333333333333333, (y * y), 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma(((x * x) * x), fma((x * x), 0.008333333333333333, -0.16666666666666666), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (sin(x) <= 1e-5) tmp = Float64(fma(fma(0.008333333333333333, Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = fma(Float64(Float64(x * x) * x), fma(Float64(x * x), 0.008333333333333333, -0.16666666666666666), x); end return tmp end
code[x_, y_] := If[LessEqual[N[Sin[x], $MachinePrecision], 1e-5], N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin x \leq 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, 0.008333333333333333, -0.16666666666666666\right), x\right)\\
\end{array}
\end{array}
if (sin.f64 x) < 1.00000000000000008e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval72.1
Applied rewrites72.1%
Applied rewrites72.1%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.0
Applied rewrites71.0%
if 1.00000000000000008e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6440.1
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites23.6%
Applied rewrites23.6%
Final simplification61.2%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(*
(fma (* (fma 0.008333333333333333 (* y y) 0.16666666666666666) y) y 1.0)
(sin x))
(if (<= y 1.8e+47)
(/ 1.0 (/ (/ y x) (sinh y)))
(if (<= y 4e+77)
(*
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(* (fma (* 0.008333333333333333 (* y y)) (* y y) 1.0) (sin x))))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma((fma(0.008333333333333333, (y * y), 0.16666666666666666) * y), y, 1.0) * sin(x);
} else if (y <= 1.8e+47) {
tmp = 1.0 / ((y / x) / sinh(y));
} else if (y <= 4e+77) {
tmp = fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma((0.008333333333333333 * (y * y)), (y * y), 1.0) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(Float64(fma(0.008333333333333333, Float64(y * y), 0.16666666666666666) * y), y, 1.0) * sin(x)); elseif (y <= 1.8e+47) tmp = Float64(1.0 / Float64(Float64(y / x) / sinh(y))); elseif (y <= 4e+77) tmp = Float64(fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = Float64(fma(Float64(0.008333333333333333 * Float64(y * y)), Float64(y * y), 1.0) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+47], N[(1.0 / N[(N[(y / x), $MachinePrecision] / N[Sinh[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+77], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, 0.16666666666666666\right) \cdot y, y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{1}{\frac{\frac{y}{x}}{\sinh y}}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.008333333333333333 \cdot \left(y \cdot y\right), y \cdot y, 1\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.2
Applied rewrites89.2%
Applied rewrites89.2%
if 0.52000000000000002 < y < 1.80000000000000004e47Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6482.6
Applied rewrites82.6%
if 1.80000000000000004e47 < y < 3.99999999999999993e77Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval80.8
Applied rewrites80.8%
Applied rewrites80.8%
Applied rewrites80.8%
if 3.99999999999999993e77 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification90.7%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(*
(fma (* (fma 0.008333333333333333 (* y y) 0.16666666666666666) y) y 1.0)
(sin x))
(if (<= y 1.8e+47)
(/ (sinh y) (/ y x))
(if (<= y 4e+77)
(*
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(* (fma (* 0.008333333333333333 (* y y)) (* y y) 1.0) (sin x))))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma((fma(0.008333333333333333, (y * y), 0.16666666666666666) * y), y, 1.0) * sin(x);
} else if (y <= 1.8e+47) {
tmp = sinh(y) / (y / x);
} else if (y <= 4e+77) {
tmp = fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma((0.008333333333333333 * (y * y)), (y * y), 1.0) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(Float64(fma(0.008333333333333333, Float64(y * y), 0.16666666666666666) * y), y, 1.0) * sin(x)); elseif (y <= 1.8e+47) tmp = Float64(sinh(y) / Float64(y / x)); elseif (y <= 4e+77) tmp = Float64(fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = Float64(fma(Float64(0.008333333333333333 * Float64(y * y)), Float64(y * y), 1.0) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+47], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+77], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.008333333333333333, y \cdot y, 0.16666666666666666\right) \cdot y, y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.008333333333333333 \cdot \left(y \cdot y\right), y \cdot y, 1\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.2
Applied rewrites89.2%
Applied rewrites89.2%
if 0.52000000000000002 < y < 1.80000000000000004e47Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6482.6
Applied rewrites82.6%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lower-/.f6482.6
Applied rewrites82.6%
if 1.80000000000000004e47 < y < 3.99999999999999993e77Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval80.8
Applied rewrites80.8%
Applied rewrites80.8%
Applied rewrites80.8%
if 3.99999999999999993e77 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification90.7%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(* (fma (* 0.16666666666666666 y) y 1.0) (sin x))
(if (<= y 1.8e+47)
(/ (sinh y) (/ y x))
(if (<= y 4e+77)
(*
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(* (fma (* 0.008333333333333333 (* y y)) (* y y) 1.0) (sin x))))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma((0.16666666666666666 * y), y, 1.0) * sin(x);
} else if (y <= 1.8e+47) {
tmp = sinh(y) / (y / x);
} else if (y <= 4e+77) {
tmp = fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma((0.008333333333333333 * (y * y)), (y * y), 1.0) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(Float64(0.16666666666666666 * y), y, 1.0) * sin(x)); elseif (y <= 1.8e+47) tmp = Float64(sinh(y) / Float64(y / x)); elseif (y <= 4e+77) tmp = Float64(fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = Float64(fma(Float64(0.008333333333333333 * Float64(y * y)), Float64(y * y), 1.0) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+47], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4e+77], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.008333333333333333 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 4 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.008333333333333333 \cdot \left(y \cdot y\right), y \cdot y, 1\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.3
Applied rewrites78.3%
Applied rewrites78.3%
if 0.52000000000000002 < y < 1.80000000000000004e47Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6482.6
Applied rewrites82.6%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lower-/.f6482.6
Applied rewrites82.6%
if 1.80000000000000004e47 < y < 3.99999999999999993e77Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6480.8
Applied rewrites80.8%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval80.8
Applied rewrites80.8%
Applied rewrites80.8%
Applied rewrites80.8%
if 3.99999999999999993e77 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification82.3%
(FPCore (x y)
:precision binary64
(if (<= (sin x) 1e-5)
(*
(fma (* y y) 0.16666666666666666 1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(fma
(* (* x x) x)
(fma (* x x) 0.008333333333333333 -0.16666666666666666)
x)))
double code(double x, double y) {
double tmp;
if (sin(x) <= 1e-5) {
tmp = fma((y * y), 0.16666666666666666, 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = fma(((x * x) * x), fma((x * x), 0.008333333333333333, -0.16666666666666666), x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (sin(x) <= 1e-5) tmp = Float64(fma(Float64(y * y), 0.16666666666666666, 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = fma(Float64(Float64(x * x) * x), fma(Float64(x * x), 0.008333333333333333, -0.16666666666666666), x); end return tmp end
code[x_, y_] := If[LessEqual[N[Sin[x], $MachinePrecision], 1e-5], N[(N[(N[(y * y), $MachinePrecision] * 0.16666666666666666 + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\sin x \leq 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot y, 0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(x \cdot x\right) \cdot x, \mathsf{fma}\left(x \cdot x, 0.008333333333333333, -0.16666666666666666\right), x\right)\\
\end{array}
\end{array}
if (sin.f64 x) < 1.00000000000000008e-5Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval72.1
Applied rewrites72.1%
Applied rewrites72.1%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.5
Applied rewrites60.5%
if 1.00000000000000008e-5 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6440.1
Applied rewrites40.1%
Taylor expanded in x around 0
Applied rewrites23.6%
Applied rewrites23.6%
Final simplification52.9%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(* (fma (* 0.16666666666666666 y) y 1.0) (sin x))
(if (<= y 1.8e+47)
(/ (sinh y) (/ y x))
(if (<= y 1.35e+154)
(*
(fma
(fma
(* (fma (* y y) 0.0001984126984126984 0.008333333333333333) y)
y
0.16666666666666666)
(* y y)
1.0)
(fma (* x x) (* -0.16666666666666666 x) x))
(* (* 0.16666666666666666 (* y y)) (sin x))))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma((0.16666666666666666 * y), y, 1.0) * sin(x);
} else if (y <= 1.8e+47) {
tmp = sinh(y) / (y / x);
} else if (y <= 1.35e+154) {
tmp = fma(fma((fma((y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), (y * y), 1.0) * fma((x * x), (-0.16666666666666666 * x), x);
} else {
tmp = (0.16666666666666666 * (y * y)) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(Float64(0.16666666666666666 * y), y, 1.0) * sin(x)); elseif (y <= 1.8e+47) tmp = Float64(sinh(y) / Float64(y / x)); elseif (y <= 1.35e+154) tmp = Float64(fma(fma(Float64(fma(Float64(y * y), 0.0001984126984126984, 0.008333333333333333) * y), y, 0.16666666666666666), Float64(y * y), 1.0) * fma(Float64(x * x), Float64(-0.16666666666666666 * x), x)); else tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+47], N[(N[Sinh[y], $MachinePrecision] / N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(N[(N[(N[(N[(y * y), $MachinePrecision] * 0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * y), $MachinePrecision] * y + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(-0.16666666666666666 * x), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sinh y}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(y \cdot y, 0.0001984126984126984, 0.008333333333333333\right) \cdot y, y, 0.16666666666666666\right), y \cdot y, 1\right) \cdot \mathsf{fma}\left(x \cdot x, -0.16666666666666666 \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.3
Applied rewrites78.3%
Applied rewrites78.3%
if 0.52000000000000002 < y < 1.80000000000000004e47Initial program 99.8%
lift-*.f64N/A
lift-/.f64N/A
associate-*r/N/A
clear-numN/A
lower-/.f64N/A
associate-/r*N/A
lower-/.f64N/A
lower-/.f64100.0
Applied rewrites100.0%
Taylor expanded in x around 0
lower-/.f6482.6
Applied rewrites82.6%
lift-/.f64N/A
lift-/.f64N/A
clear-numN/A
lower-/.f6482.6
Applied rewrites82.6%
if 1.80000000000000004e47 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6495.4
Applied rewrites95.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
*-commutativeN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
unpow2N/A
cube-unmultN/A
metadata-evalN/A
lower-pow.f64N/A
metadata-eval90.7
Applied rewrites90.7%
Applied rewrites90.7%
Applied rewrites90.7%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification81.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (* x x) x)))
(if (<= (sin x) -0.002)
(fma t_0 -0.16666666666666666 x)
(fma t_0 (fma (* x x) 0.008333333333333333 -0.16666666666666666) x))))
double code(double x, double y) {
double t_0 = (x * x) * x;
double tmp;
if (sin(x) <= -0.002) {
tmp = fma(t_0, -0.16666666666666666, x);
} else {
tmp = fma(t_0, fma((x * x), 0.008333333333333333, -0.16666666666666666), x);
}
return tmp;
}
function code(x, y) t_0 = Float64(Float64(x * x) * x) tmp = 0.0 if (sin(x) <= -0.002) tmp = fma(t_0, -0.16666666666666666, x); else tmp = fma(t_0, fma(Float64(x * x), 0.008333333333333333, -0.16666666666666666), x); end return tmp end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[N[Sin[x], $MachinePrecision], -0.002], N[(t$95$0 * -0.16666666666666666 + x), $MachinePrecision], N[(t$95$0 * N[(N[(x * x), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot x\\
\mathbf{if}\;\sin x \leq -0.002:\\
\;\;\;\;\mathsf{fma}\left(t\_0, -0.16666666666666666, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t\_0, \mathsf{fma}\left(x \cdot x, 0.008333333333333333, -0.16666666666666666\right), x\right)\\
\end{array}
\end{array}
if (sin.f64 x) < -2e-3Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6453.7
Applied rewrites53.7%
Taylor expanded in x around 0
Applied rewrites24.9%
Applied rewrites24.9%
if -2e-3 < (sin.f64 x) Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6446.0
Applied rewrites46.0%
Taylor expanded in x around 0
Applied rewrites41.5%
Applied rewrites41.5%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(* (fma (* 0.16666666666666666 y) y 1.0) (sin x))
(if (<= y 1.35e+154)
(*
(fma
(*
(fma
(fma (* x x) -0.0001984126984126984 0.008333333333333333)
(* x x)
-0.16666666666666666)
(* x x))
x
x)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0))
(* (* 0.16666666666666666 (* y y)) (sin x)))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = fma((0.16666666666666666 * y), y, 1.0) * sin(x);
} else if (y <= 1.35e+154) {
tmp = fma((fma(fma((x * x), -0.0001984126984126984, 0.008333333333333333), (x * x), -0.16666666666666666) * (x * x)), x, x) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
} else {
tmp = (0.16666666666666666 * (y * y)) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = Float64(fma(Float64(0.16666666666666666 * y), y, 1.0) * sin(x)); elseif (y <= 1.35e+154) tmp = Float64(fma(Float64(fma(fma(Float64(x * x), -0.0001984126984126984, 0.008333333333333333), Float64(x * x), -0.16666666666666666) * Float64(x * x)), x, x) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[(N[(N[(0.16666666666666666 * y), $MachinePrecision] * y + 1.0), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\mathsf{fma}\left(0.16666666666666666 \cdot y, y, 1\right) \cdot \sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.0001984126984126984, 0.008333333333333333\right), x \cdot x, -0.16666666666666666\right) \cdot \left(x \cdot x\right), x, x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.3
Applied rewrites78.3%
Applied rewrites78.3%
if 0.52000000000000002 < y < 1.35000000000000003e154Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites74.3%
Applied rewrites74.3%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification80.4%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(sin x)
(if (<= y 1.35e+154)
(*
(fma
(*
(fma
(fma (* x x) -0.0001984126984126984 0.008333333333333333)
(* x x)
-0.16666666666666666)
(* x x))
x
x)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0))
(* (* 0.16666666666666666 (* y y)) (sin x)))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = fma((fma(fma((x * x), -0.0001984126984126984, 0.008333333333333333), (x * x), -0.16666666666666666) * (x * x)), x, x) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
} else {
tmp = (0.16666666666666666 * (y * y)) * sin(x);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = sin(x); elseif (y <= 1.35e+154) tmp = Float64(fma(Float64(fma(fma(Float64(x * x), -0.0001984126984126984, 0.008333333333333333), Float64(x * x), -0.16666666666666666) * Float64(x * x)), x, x) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); else tmp = Float64(Float64(0.16666666666666666 * Float64(y * y)) * sin(x)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.0001984126984126984, 0.008333333333333333\right), x \cdot x, -0.16666666666666666\right) \cdot \left(x \cdot x\right), x, x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.16666666666666666 \cdot \left(y \cdot y\right)\right) \cdot \sin x\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6460.7
Applied rewrites60.7%
if 0.52000000000000002 < y < 1.35000000000000003e154Initial program 99.9%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites74.3%
Applied rewrites74.3%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in y around inf
Applied rewrites100.0%
Final simplification66.6%
(FPCore (x y)
:precision binary64
(if (<= y 0.52)
(sin x)
(*
(fma
(*
(fma
(fma (* x x) -0.0001984126984126984 0.008333333333333333)
(* x x)
-0.16666666666666666)
(* x x))
x
x)
(fma
(fma
(fma 0.0001984126984126984 (* y y) 0.008333333333333333)
(* y y)
0.16666666666666666)
(* y y)
1.0))))
double code(double x, double y) {
double tmp;
if (y <= 0.52) {
tmp = sin(x);
} else {
tmp = fma((fma(fma((x * x), -0.0001984126984126984, 0.008333333333333333), (x * x), -0.16666666666666666) * (x * x)), x, x) * fma(fma(fma(0.0001984126984126984, (y * y), 0.008333333333333333), (y * y), 0.16666666666666666), (y * y), 1.0);
}
return tmp;
}
function code(x, y) tmp = 0.0 if (y <= 0.52) tmp = sin(x); else tmp = Float64(fma(Float64(fma(fma(Float64(x * x), -0.0001984126984126984, 0.008333333333333333), Float64(x * x), -0.16666666666666666) * Float64(x * x)), x, x) * fma(fma(fma(0.0001984126984126984, Float64(y * y), 0.008333333333333333), Float64(y * y), 0.16666666666666666), Float64(y * y), 1.0)); end return tmp end
code[x_, y_] := If[LessEqual[y, 0.52], N[Sin[x], $MachinePrecision], N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] * -0.0001984126984126984 + 0.008333333333333333), $MachinePrecision] * N[(x * x), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision] * N[(N[(N[(0.0001984126984126984 * N[(y * y), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * N[(y * y), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] * N[(y * y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.52:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -0.0001984126984126984, 0.008333333333333333\right), x \cdot x, -0.16666666666666666\right) \cdot \left(x \cdot x\right), x, x\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.0001984126984126984, y \cdot y, 0.008333333333333333\right), y \cdot y, 0.16666666666666666\right), y \cdot y, 1\right)\\
\end{array}
\end{array}
if y < 0.52000000000000002Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6460.7
Applied rewrites60.7%
if 0.52000000000000002 < y Initial program 100.0%
Taylor expanded in y around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.4
Applied rewrites87.4%
Taylor expanded in x around 0
+-commutativeN/A
distribute-lft-inN/A
associate-*r*N/A
*-rgt-identityN/A
lower-fma.f64N/A
Applied rewrites78.6%
Applied rewrites78.6%
(FPCore (x y) :precision binary64 (fma (* (* x x) x) -0.16666666666666666 x))
double code(double x, double y) {
return fma(((x * x) * x), -0.16666666666666666, x);
}
function code(x, y) return fma(Float64(Float64(x * x) * x), -0.16666666666666666, x) end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * -0.16666666666666666 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(x \cdot x\right) \cdot x, -0.16666666666666666, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6447.9
Applied rewrites47.9%
Taylor expanded in x around 0
Applied rewrites39.0%
Applied rewrites39.0%
(FPCore (x y) :precision binary64 (fma (* -0.16666666666666666 (* x x)) x x))
double code(double x, double y) {
return fma((-0.16666666666666666 * (x * x)), x, x);
}
function code(x, y) return fma(Float64(-0.16666666666666666 * Float64(x * x)), x, x) end
code[x_, y_] := N[(N[(-0.16666666666666666 * N[(x * x), $MachinePrecision]), $MachinePrecision] * x + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(-0.16666666666666666 \cdot \left(x \cdot x\right), x, x\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0
lower-sin.f6447.9
Applied rewrites47.9%
Taylor expanded in x around 0
Applied rewrites39.0%
Applied rewrites38.7%
herbie shell --seed 2024255
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))