
(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 11 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 (* (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}
Initial program 100.0%
Final simplification100.0%
(FPCore (x y)
:precision binary64
(if (or (<= y 3.9e+30) (not (<= y 8e+150)))
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(/
(- (* x x) (* (* x x) (* (pow y 4.0) 0.027777777777777776)))
(- x (* (* y y) (* x 0.16666666666666666))))))
double code(double x, double y) {
double tmp;
if ((y <= 3.9e+30) || !(y <= 8e+150)) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = ((x * x) - ((x * x) * (pow(y, 4.0) * 0.027777777777777776))) / (x - ((y * y) * (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 <= 3.9d+30) .or. (.not. (y <= 8d+150))) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = ((x * x) - ((x * x) * ((y ** 4.0d0) * 0.027777777777777776d0))) / (x - ((y * y) * (x * 0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 3.9e+30) || !(y <= 8e+150)) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = ((x * x) - ((x * x) * (Math.pow(y, 4.0) * 0.027777777777777776))) / (x - ((y * y) * (x * 0.16666666666666666)));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 3.9e+30) or not (y <= 8e+150): tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = ((x * x) - ((x * x) * (math.pow(y, 4.0) * 0.027777777777777776))) / (x - ((y * y) * (x * 0.16666666666666666))) return tmp
function code(x, y) tmp = 0.0 if ((y <= 3.9e+30) || !(y <= 8e+150)) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(Float64(Float64(x * x) - Float64(Float64(x * x) * Float64((y ^ 4.0) * 0.027777777777777776))) / Float64(x - Float64(Float64(y * y) * Float64(x * 0.16666666666666666)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 3.9e+30) || ~((y <= 8e+150))) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = ((x * x) - ((x * x) * ((y ^ 4.0) * 0.027777777777777776))) / (x - ((y * y) * (x * 0.16666666666666666))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 3.9e+30], N[Not[LessEqual[y, 8e+150]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * x), $MachinePrecision] - N[(N[(x * x), $MachinePrecision] * N[(N[Power[y, 4.0], $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x - N[(N[(y * y), $MachinePrecision] * N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.9 \cdot 10^{+30} \lor \neg \left(y \leq 8 \cdot 10^{+150}\right):\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x - \left(x \cdot x\right) \cdot \left({y}^{4} \cdot 0.027777777777777776\right)}{x - \left(y \cdot y\right) \cdot \left(x \cdot 0.16666666666666666\right)}\\
\end{array}
\end{array}
if y < 3.90000000000000011e30 or 7.99999999999999985e150 < y Initial program 100.0%
Taylor expanded in y around 0 85.7%
unpow285.7%
Simplified85.7%
if 3.90000000000000011e30 < y < 7.99999999999999985e150Initial program 100.0%
Taylor expanded in y around 0 4.5%
unpow24.5%
Simplified4.5%
Taylor expanded in x around 0 18.3%
+-commutative18.3%
unpow218.3%
fma-udef18.3%
Simplified18.3%
fma-udef18.3%
Applied egg-rr18.3%
distribute-rgt1-in18.3%
associate-*r*18.3%
associate-*r*18.3%
flip-+21.0%
Applied egg-rr46.7%
associate-*l*46.7%
associate-*r*46.7%
*-commutative46.7%
Simplified46.7%
Final simplification81.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 38000000.0)
(sin x)
(if (<= y 6.6e+78)
(* y (* (* y -0.027777777777777776) (pow x 3.0)))
(if (<= y 1.35e+154) (* x (+ 1.0 t_0)) (* (sin x) t_0))))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 38000000.0) {
tmp = sin(x);
} else if (y <= 6.6e+78) {
tmp = y * ((y * -0.027777777777777776) * pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (1.0 + t_0);
} else {
tmp = sin(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 <= 38000000.0d0) then
tmp = sin(x)
else if (y <= 6.6d+78) then
tmp = y * ((y * (-0.027777777777777776d0)) * (x ** 3.0d0))
else if (y <= 1.35d+154) then
tmp = x * (1.0d0 + t_0)
else
tmp = sin(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 <= 38000000.0) {
tmp = Math.sin(x);
} else if (y <= 6.6e+78) {
tmp = y * ((y * -0.027777777777777776) * Math.pow(x, 3.0));
} else if (y <= 1.35e+154) {
tmp = x * (1.0 + t_0);
} else {
tmp = Math.sin(x) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 38000000.0: tmp = math.sin(x) elif y <= 6.6e+78: tmp = y * ((y * -0.027777777777777776) * math.pow(x, 3.0)) elif y <= 1.35e+154: tmp = x * (1.0 + t_0) else: tmp = math.sin(x) * t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 38000000.0) tmp = sin(x); elseif (y <= 6.6e+78) tmp = Float64(y * Float64(Float64(y * -0.027777777777777776) * (x ^ 3.0))); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(1.0 + t_0)); else tmp = Float64(sin(x) * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 38000000.0) tmp = sin(x); elseif (y <= 6.6e+78) tmp = y * ((y * -0.027777777777777776) * (x ^ 3.0)); elseif (y <= 1.35e+154) tmp = x * (1.0 + t_0); else tmp = sin(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, 38000000.0], N[Sin[x], $MachinePrecision], If[LessEqual[y, 6.6e+78], N[(y * N[(N[(y * -0.027777777777777776), $MachinePrecision] * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[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 38000000:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 6.6 \cdot 10^{+78}:\\
\;\;\;\;y \cdot \left(\left(y \cdot -0.027777777777777776\right) \cdot {x}^{3}\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot t_0\\
\end{array}
\end{array}
if y < 3.8e7Initial program 100.0%
Taylor expanded in y around 0 67.7%
if 3.8e7 < y < 6.6e78Initial program 100.0%
Taylor expanded in y around 0 3.7%
unpow23.7%
Simplified3.7%
Taylor expanded in y around inf 3.7%
unpow23.7%
associate-*l*3.7%
Simplified3.7%
Taylor expanded in x around 0 23.0%
*-commutative23.0%
associate-*l*23.0%
*-commutative23.0%
associate-*l*23.0%
distribute-lft-out30.2%
unpow230.2%
*-commutative30.2%
Simplified30.2%
Taylor expanded in x around inf 29.6%
*-commutative29.6%
unpow229.6%
associate-*r*29.6%
associate-*r*29.6%
*-commutative29.6%
associate-*r*29.6%
Simplified29.6%
if 6.6e78 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 6.3%
unpow26.3%
Simplified6.3%
Taylor expanded in x around 0 34.6%
+-commutative34.6%
unpow234.6%
fma-udef34.6%
Simplified34.6%
fma-udef34.6%
Applied egg-rr34.6%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification66.6%
(FPCore (x y)
:precision binary64
(if (<= y 3.9e-5)
(sin x)
(if (<= y 1.8e+258)
(* x (+ 1.0 (* 0.16666666666666666 (* y y))))
(* 0.16666666666666666 (* y (* (sin x) y))))))
double code(double x, double y) {
double tmp;
if (y <= 3.9e-5) {
tmp = sin(x);
} else if (y <= 1.8e+258) {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = 0.16666666666666666 * (y * (sin(x) * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.9d-5) then
tmp = sin(x)
else if (y <= 1.8d+258) then
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = 0.16666666666666666d0 * (y * (sin(x) * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.9e-5) {
tmp = Math.sin(x);
} else if (y <= 1.8e+258) {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = 0.16666666666666666 * (y * (Math.sin(x) * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.9e-5: tmp = math.sin(x) elif y <= 1.8e+258: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = 0.16666666666666666 * (y * (math.sin(x) * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.9e-5) tmp = sin(x); elseif (y <= 1.8e+258) tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(0.16666666666666666 * Float64(y * Float64(sin(x) * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.9e-5) tmp = sin(x); elseif (y <= 1.8e+258) tmp = x * (1.0 + (0.16666666666666666 * (y * y))); else tmp = 0.16666666666666666 * (y * (sin(x) * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.9e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.8e+258], N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(y * N[(N[Sin[x], $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.9 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.8 \cdot 10^{+258}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(\sin x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 3.8999999999999999e-5Initial program 100.0%
Taylor expanded in y around 0 68.5%
if 3.8999999999999999e-5 < y < 1.8e258Initial program 100.0%
Taylor expanded in y around 0 41.3%
unpow241.3%
Simplified41.3%
Taylor expanded in x around 0 46.4%
+-commutative46.4%
unpow246.4%
fma-udef46.4%
Simplified46.4%
fma-udef46.4%
Applied egg-rr46.4%
if 1.8e258 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*l*100.0%
Simplified100.0%
Final simplification64.3%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* 0.16666666666666666 (* y y))))
(if (<= y 5.7e-5)
(sin x)
(if (<= y 1.35e+154) (* x (+ 1.0 t_0)) (* (sin x) t_0)))))
double code(double x, double y) {
double t_0 = 0.16666666666666666 * (y * y);
double tmp;
if (y <= 5.7e-5) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = x * (1.0 + t_0);
} else {
tmp = sin(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 <= 5.7d-5) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = x * (1.0d0 + t_0)
else
tmp = sin(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 <= 5.7e-5) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = x * (1.0 + t_0);
} else {
tmp = Math.sin(x) * t_0;
}
return tmp;
}
def code(x, y): t_0 = 0.16666666666666666 * (y * y) tmp = 0 if y <= 5.7e-5: tmp = math.sin(x) elif y <= 1.35e+154: tmp = x * (1.0 + t_0) else: tmp = math.sin(x) * t_0 return tmp
function code(x, y) t_0 = Float64(0.16666666666666666 * Float64(y * y)) tmp = 0.0 if (y <= 5.7e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(1.0 + t_0)); else tmp = Float64(sin(x) * t_0); end return tmp end
function tmp_2 = code(x, y) t_0 = 0.16666666666666666 * (y * y); tmp = 0.0; if (y <= 5.7e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = x * (1.0 + t_0); else tmp = sin(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, 5.7e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sin[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 5.7 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \left(1 + t_0\right)\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot t_0\\
\end{array}
\end{array}
if y < 5.7000000000000003e-5Initial program 100.0%
Taylor expanded in y around 0 68.5%
if 5.7000000000000003e-5 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 7.0%
unpow27.0%
Simplified7.0%
Taylor expanded in x around 0 23.5%
+-commutative23.5%
unpow223.5%
fma-udef23.5%
Simplified23.5%
fma-udef23.5%
Applied egg-rr23.5%
if 1.35000000000000003e154 < y Initial program 100.0%
Taylor expanded in y around 0 100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in y around inf 100.0%
unpow2100.0%
associate-*r*100.0%
*-commutative100.0%
Simplified100.0%
Final simplification65.5%
(FPCore (x y) :precision binary64 (* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
}
def code(x, y): return math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 77.5%
unpow277.5%
Simplified77.5%
Final simplification77.5%
(FPCore (x y) :precision binary64 (if (<= y 3.5e-5) (sin x) (* x (+ 1.0 (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 3.5e-5) {
tmp = sin(x);
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 3.5d-5) then
tmp = sin(x)
else
tmp = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 3.5e-5) {
tmp = Math.sin(x);
} else {
tmp = x * (1.0 + (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 3.5e-5: tmp = math.sin(x) else: tmp = x * (1.0 + (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 3.5e-5) tmp = sin(x); else tmp = Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 3.5e-5) tmp = sin(x); else tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 3.5e-5], N[Sin[x], $MachinePrecision], N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 3.4999999999999997e-5Initial program 100.0%
Taylor expanded in y around 0 68.5%
if 3.4999999999999997e-5 < y Initial program 100.0%
Taylor expanded in y around 0 46.9%
unpow246.9%
Simplified46.9%
Taylor expanded in x around 0 48.4%
+-commutative48.4%
unpow248.4%
fma-udef48.4%
Simplified48.4%
fma-udef48.4%
Applied egg-rr48.4%
Final simplification63.5%
(FPCore (x y) :precision binary64 (if (<= y 0.96) x (* 0.16666666666666666 (* y (* x y)))))
double code(double x, double y) {
double tmp;
if (y <= 0.96) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (x * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.96d0) then
tmp = x
else
tmp = 0.16666666666666666d0 * (y * (x * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.96) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (y * (x * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.96: tmp = x else: tmp = 0.16666666666666666 * (y * (x * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.96) tmp = x; else tmp = Float64(0.16666666666666666 * Float64(y * Float64(x * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.96) tmp = x; else tmp = 0.16666666666666666 * (y * (x * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.96], x, N[(0.16666666666666666 * N[(y * N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.96:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(y \cdot \left(x \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.95999999999999996Initial program 100.0%
Taylor expanded in y around 0 87.3%
unpow287.3%
Simplified87.3%
Taylor expanded in x around 0 51.8%
+-commutative51.8%
unpow251.8%
fma-udef51.8%
Simplified51.8%
Taylor expanded in y around 0 37.2%
if 0.95999999999999996 < y Initial program 100.0%
Taylor expanded in y around 0 46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in y around inf 46.6%
unpow246.6%
associate-*l*42.1%
Simplified42.1%
Taylor expanded in x around 0 48.3%
unpow248.3%
associate-*l*43.8%
Simplified43.8%
Final simplification38.8%
(FPCore (x y) :precision binary64 (if (<= y 0.96) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 0.96) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 0.96d0) then
tmp = x
else
tmp = 0.16666666666666666d0 * (x * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 0.96) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 0.96: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 0.96) tmp = x; else tmp = Float64(0.16666666666666666 * Float64(x * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 0.96) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 0.96], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.96:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 0.95999999999999996Initial program 100.0%
Taylor expanded in y around 0 87.3%
unpow287.3%
Simplified87.3%
Taylor expanded in x around 0 51.8%
+-commutative51.8%
unpow251.8%
fma-udef51.8%
Simplified51.8%
Taylor expanded in y around 0 37.2%
if 0.95999999999999996 < y Initial program 100.0%
Taylor expanded in y around 0 46.8%
unpow246.8%
Simplified46.8%
Taylor expanded in y around inf 46.6%
unpow246.6%
associate-*l*42.1%
Simplified42.1%
Taylor expanded in x around 0 48.3%
unpow248.3%
Simplified48.3%
Final simplification39.9%
(FPCore (x y) :precision binary64 (* x (+ 1.0 (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return x * (1.0 + (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (1.0d0 + (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return x * (1.0 + (0.16666666666666666 * (y * y)));
}
def code(x, y): return x * (1.0 + (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(x * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = x * (1.0 + (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(x * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 77.5%
unpow277.5%
Simplified77.5%
Taylor expanded in x around 0 51.0%
+-commutative51.0%
unpow251.0%
fma-udef51.0%
Simplified51.0%
fma-udef51.0%
Applied egg-rr51.0%
Final simplification51.0%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 100.0%
Taylor expanded in y around 0 77.5%
unpow277.5%
Simplified77.5%
Taylor expanded in x around 0 51.0%
+-commutative51.0%
unpow251.0%
fma-udef51.0%
Simplified51.0%
Taylor expanded in y around 0 29.0%
Final simplification29.0%
herbie shell --seed 2023214
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))