
(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 99.7%
Final simplification99.7%
(FPCore (x y)
:precision binary64
(let* ((t_0
(*
x
(/
(- 1.0 (* (pow y 4.0) 0.027777777777777776))
(+ 1.0 (* (* y y) -0.16666666666666666))))))
(if (<= y 2.65e+39)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 4.7e+111)
t_0
(if (<= y 7.2e+132)
(*
(* y y)
(+ (* -0.027777777777777776 (pow x 3.0)) (* x 0.16666666666666666)))
(if (<= y 1.35e+154)
t_0
(* 0.16666666666666666 (* (sin x) (* y y)))))))))
double code(double x, double y) {
double t_0 = x * ((1.0 - (pow(y, 4.0) * 0.027777777777777776)) / (1.0 + ((y * y) * -0.16666666666666666)));
double tmp;
if (y <= 2.65e+39) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.7e+111) {
tmp = t_0;
} else if (y <= 7.2e+132) {
tmp = (y * y) * ((-0.027777777777777776 * pow(x, 3.0)) + (x * 0.16666666666666666));
} else if (y <= 1.35e+154) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (sin(x) * (y * y));
}
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 = x * ((1.0d0 - ((y ** 4.0d0) * 0.027777777777777776d0)) / (1.0d0 + ((y * y) * (-0.16666666666666666d0))))
if (y <= 2.65d+39) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 4.7d+111) then
tmp = t_0
else if (y <= 7.2d+132) then
tmp = (y * y) * (((-0.027777777777777776d0) * (x ** 3.0d0)) + (x * 0.16666666666666666d0))
else if (y <= 1.35d+154) then
tmp = t_0
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x * ((1.0 - (Math.pow(y, 4.0) * 0.027777777777777776)) / (1.0 + ((y * y) * -0.16666666666666666)));
double tmp;
if (y <= 2.65e+39) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.7e+111) {
tmp = t_0;
} else if (y <= 7.2e+132) {
tmp = (y * y) * ((-0.027777777777777776 * Math.pow(x, 3.0)) + (x * 0.16666666666666666));
} else if (y <= 1.35e+154) {
tmp = t_0;
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): t_0 = x * ((1.0 - (math.pow(y, 4.0) * 0.027777777777777776)) / (1.0 + ((y * y) * -0.16666666666666666))) tmp = 0 if y <= 2.65e+39: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 4.7e+111: tmp = t_0 elif y <= 7.2e+132: tmp = (y * y) * ((-0.027777777777777776 * math.pow(x, 3.0)) + (x * 0.16666666666666666)) elif y <= 1.35e+154: tmp = t_0 else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) t_0 = Float64(x * Float64(Float64(1.0 - Float64((y ^ 4.0) * 0.027777777777777776)) / Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666)))) tmp = 0.0 if (y <= 2.65e+39) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 4.7e+111) tmp = t_0; elseif (y <= 7.2e+132) tmp = Float64(Float64(y * y) * Float64(Float64(-0.027777777777777776 * (x ^ 3.0)) + Float64(x * 0.16666666666666666))); elseif (y <= 1.35e+154) tmp = t_0; else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) t_0 = x * ((1.0 - ((y ^ 4.0) * 0.027777777777777776)) / (1.0 + ((y * y) * -0.16666666666666666))); tmp = 0.0; if (y <= 2.65e+39) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 4.7e+111) tmp = t_0; elseif (y <= 7.2e+132) tmp = (y * y) * ((-0.027777777777777776 * (x ^ 3.0)) + (x * 0.16666666666666666)); elseif (y <= 1.35e+154) tmp = t_0; else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x * N[(N[(1.0 - N[(N[Power[y, 4.0], $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision] / N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.65e+39], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.7e+111], t$95$0, If[LessEqual[y, 7.2e+132], N[(N[(y * y), $MachinePrecision] * N[(N[(-0.027777777777777776 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], t$95$0, N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{1 - {y}^{4} \cdot 0.027777777777777776}{1 + \left(y \cdot y\right) \cdot -0.16666666666666666}\\
\mathbf{if}\;y \leq 2.65 \cdot 10^{+39}:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{+111}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+132}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(-0.027777777777777776 \cdot {x}^{3} + x \cdot 0.16666666666666666\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 2.64999999999999989e39Initial program 99.6%
Taylor expanded in y around 0 79.1%
unpow279.1%
Simplified79.1%
if 2.64999999999999989e39 < y < 4.70000000000000008e111 or 7.20000000000000031e132 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 4.7%
unpow24.7%
Simplified4.7%
Taylor expanded in x around 0 19.3%
+-commutative19.3%
unpow219.3%
fma-udef19.3%
Simplified19.3%
fma-udef19.3%
associate-*r*19.3%
*-commutative19.3%
+-commutative19.3%
flip-+67.1%
metadata-eval67.1%
div-sub67.1%
*-commutative67.1%
associate-*r*67.1%
cancel-sign-sub-inv67.1%
metadata-eval67.1%
Applied egg-rr67.1%
div-sub67.1%
Simplified67.1%
if 4.70000000000000008e111 < y < 7.20000000000000031e132Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in y around inf 5.8%
unpow25.8%
associate-*l*5.8%
Simplified5.8%
Taylor expanded in x around 0 0.7%
unpow20.7%
associate-*r*0.7%
unpow20.7%
associate-*r*0.7%
distribute-rgt-out80.7%
Simplified80.7%
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-*l*83.4%
Simplified83.4%
Taylor expanded in y around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification81.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (- 1.0 (* (pow y 4.0) 0.027777777777777776)))
(t_1 (+ 1.0 (* (* y y) -0.16666666666666666))))
(if (<= y 2.32e+39)
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(if (<= y 4.7e+111)
(/ (* x t_0) t_1)
(if (<= y 7.2e+132)
(*
(* y y)
(+ (* -0.027777777777777776 (pow x 3.0)) (* x 0.16666666666666666)))
(if (<= y 1.35e+154)
(* x (/ t_0 t_1))
(* 0.16666666666666666 (* (sin x) (* y y)))))))))
double code(double x, double y) {
double t_0 = 1.0 - (pow(y, 4.0) * 0.027777777777777776);
double t_1 = 1.0 + ((y * y) * -0.16666666666666666);
double tmp;
if (y <= 2.32e+39) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.7e+111) {
tmp = (x * t_0) / t_1;
} else if (y <= 7.2e+132) {
tmp = (y * y) * ((-0.027777777777777776 * pow(x, 3.0)) + (x * 0.16666666666666666));
} else if (y <= 1.35e+154) {
tmp = x * (t_0 / t_1);
} else {
tmp = 0.16666666666666666 * (sin(x) * (y * y));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 1.0d0 - ((y ** 4.0d0) * 0.027777777777777776d0)
t_1 = 1.0d0 + ((y * y) * (-0.16666666666666666d0))
if (y <= 2.32d+39) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else if (y <= 4.7d+111) then
tmp = (x * t_0) / t_1
else if (y <= 7.2d+132) then
tmp = (y * y) * (((-0.027777777777777776d0) * (x ** 3.0d0)) + (x * 0.16666666666666666d0))
else if (y <= 1.35d+154) then
tmp = x * (t_0 / t_1)
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 - (Math.pow(y, 4.0) * 0.027777777777777776);
double t_1 = 1.0 + ((y * y) * -0.16666666666666666);
double tmp;
if (y <= 2.32e+39) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else if (y <= 4.7e+111) {
tmp = (x * t_0) / t_1;
} else if (y <= 7.2e+132) {
tmp = (y * y) * ((-0.027777777777777776 * Math.pow(x, 3.0)) + (x * 0.16666666666666666));
} else if (y <= 1.35e+154) {
tmp = x * (t_0 / t_1);
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): t_0 = 1.0 - (math.pow(y, 4.0) * 0.027777777777777776) t_1 = 1.0 + ((y * y) * -0.16666666666666666) tmp = 0 if y <= 2.32e+39: tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) elif y <= 4.7e+111: tmp = (x * t_0) / t_1 elif y <= 7.2e+132: tmp = (y * y) * ((-0.027777777777777776 * math.pow(x, 3.0)) + (x * 0.16666666666666666)) elif y <= 1.35e+154: tmp = x * (t_0 / t_1) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) t_0 = Float64(1.0 - Float64((y ^ 4.0) * 0.027777777777777776)) t_1 = Float64(1.0 + Float64(Float64(y * y) * -0.16666666666666666)) tmp = 0.0 if (y <= 2.32e+39) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); elseif (y <= 4.7e+111) tmp = Float64(Float64(x * t_0) / t_1); elseif (y <= 7.2e+132) tmp = Float64(Float64(y * y) * Float64(Float64(-0.027777777777777776 * (x ^ 3.0)) + Float64(x * 0.16666666666666666))); elseif (y <= 1.35e+154) tmp = Float64(x * Float64(t_0 / t_1)); else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 - ((y ^ 4.0) * 0.027777777777777776); t_1 = 1.0 + ((y * y) * -0.16666666666666666); tmp = 0.0; if (y <= 2.32e+39) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); elseif (y <= 4.7e+111) tmp = (x * t_0) / t_1; elseif (y <= 7.2e+132) tmp = (y * y) * ((-0.027777777777777776 * (x ^ 3.0)) + (x * 0.16666666666666666)); elseif (y <= 1.35e+154) tmp = x * (t_0 / t_1); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 - N[(N[Power[y, 4.0], $MachinePrecision] * 0.027777777777777776), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 + N[(N[(y * y), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.32e+39], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.7e+111], N[(N[(x * t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y, 7.2e+132], N[(N[(y * y), $MachinePrecision] * N[(N[(-0.027777777777777776 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x * N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - {y}^{4} \cdot 0.027777777777777776\\
t_1 := 1 + \left(y \cdot y\right) \cdot -0.16666666666666666\\
\mathbf{if}\;y \leq 2.32 \cdot 10^{+39}:\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{elif}\;y \leq 4.7 \cdot 10^{+111}:\\
\;\;\;\;\frac{x \cdot t_0}{t_1}\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{+132}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(-0.027777777777777776 \cdot {x}^{3} + x \cdot 0.16666666666666666\right)\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x \cdot \frac{t_0}{t_1}\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 2.32000000000000005e39Initial program 99.6%
Taylor expanded in y around 0 79.1%
unpow279.1%
Simplified79.1%
if 2.32000000000000005e39 < y < 4.70000000000000008e111Initial program 100.0%
Taylor expanded in y around 0 3.9%
unpow23.9%
Simplified3.9%
Taylor expanded in x around 0 20.4%
+-commutative20.4%
unpow220.4%
fma-udef20.4%
Simplified20.4%
*-commutative20.4%
fma-udef20.4%
associate-*r*20.4%
*-commutative20.4%
+-commutative20.4%
flip-+55.3%
associate-*l/55.3%
Applied egg-rr55.3%
if 4.70000000000000008e111 < y < 7.20000000000000031e132Initial program 100.0%
Taylor expanded in y around 0 5.8%
unpow25.8%
Simplified5.8%
Taylor expanded in y around inf 5.8%
unpow25.8%
associate-*l*5.8%
Simplified5.8%
Taylor expanded in x around 0 0.7%
unpow20.7%
associate-*r*0.7%
unpow20.7%
associate-*r*0.7%
distribute-rgt-out80.7%
Simplified80.7%
if 7.20000000000000031e132 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 6.1%
unpow26.1%
Simplified6.1%
Taylor expanded in x around 0 17.6%
+-commutative17.6%
unpow217.6%
fma-udef17.6%
Simplified17.6%
fma-udef17.6%
associate-*r*17.6%
*-commutative17.6%
+-commutative17.6%
flip-+85.7%
metadata-eval85.7%
div-sub85.7%
*-commutative85.7%
associate-*r*85.7%
cancel-sign-sub-inv85.7%
metadata-eval85.7%
Applied egg-rr85.7%
div-sub85.7%
Simplified85.7%
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-*l*83.4%
Simplified83.4%
Taylor expanded in y around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification81.0%
(FPCore (x y)
:precision binary64
(if (or (<= y 105000000000.0) (not (<= y 3e+149)))
(* (sin x) (+ 1.0 (* 0.16666666666666666 (* y y))))
(*
(* y y)
(+ (* -0.027777777777777776 (pow x 3.0)) (* x 0.16666666666666666)))))
double code(double x, double y) {
double tmp;
if ((y <= 105000000000.0) || !(y <= 3e+149)) {
tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = (y * y) * ((-0.027777777777777776 * pow(x, 3.0)) + (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 <= 105000000000.0d0) .or. (.not. (y <= 3d+149))) then
tmp = sin(x) * (1.0d0 + (0.16666666666666666d0 * (y * y)))
else
tmp = (y * y) * (((-0.027777777777777776d0) * (x ** 3.0d0)) + (x * 0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((y <= 105000000000.0) || !(y <= 3e+149)) {
tmp = Math.sin(x) * (1.0 + (0.16666666666666666 * (y * y)));
} else {
tmp = (y * y) * ((-0.027777777777777776 * Math.pow(x, 3.0)) + (x * 0.16666666666666666));
}
return tmp;
}
def code(x, y): tmp = 0 if (y <= 105000000000.0) or not (y <= 3e+149): tmp = math.sin(x) * (1.0 + (0.16666666666666666 * (y * y))) else: tmp = (y * y) * ((-0.027777777777777776 * math.pow(x, 3.0)) + (x * 0.16666666666666666)) return tmp
function code(x, y) tmp = 0.0 if ((y <= 105000000000.0) || !(y <= 3e+149)) tmp = Float64(sin(x) * Float64(1.0 + Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(Float64(y * y) * Float64(Float64(-0.027777777777777776 * (x ^ 3.0)) + Float64(x * 0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((y <= 105000000000.0) || ~((y <= 3e+149))) tmp = sin(x) * (1.0 + (0.16666666666666666 * (y * y))); else tmp = (y * y) * ((-0.027777777777777776 * (x ^ 3.0)) + (x * 0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[y, 105000000000.0], N[Not[LessEqual[y, 3e+149]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(1.0 + N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * y), $MachinePrecision] * N[(N[(-0.027777777777777776 * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(x * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 105000000000 \lor \neg \left(y \leq 3 \cdot 10^{+149}\right):\\
\;\;\;\;\sin x \cdot \left(1 + 0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(-0.027777777777777776 \cdot {x}^{3} + x \cdot 0.16666666666666666\right)\\
\end{array}
\end{array}
if y < 1.05e11 or 3.00000000000000003e149 < y Initial program 99.6%
Taylor expanded in y around 0 83.4%
unpow283.4%
Simplified83.4%
if 1.05e11 < y < 3.00000000000000003e149Initial program 100.0%
Taylor expanded in y around 0 4.6%
unpow24.6%
Simplified4.6%
Taylor expanded in y around inf 4.6%
unpow24.6%
associate-*l*4.6%
Simplified4.6%
Taylor expanded in x around 0 9.5%
unpow29.5%
associate-*r*9.5%
unpow29.5%
associate-*r*9.5%
distribute-rgt-out31.8%
Simplified31.8%
Final simplification78.0%
(FPCore (x y)
:precision binary64
(if (<= y 1.6e-5)
(sin x)
(if (<= y 1.4e+215)
(+ x (* x (* 0.16666666666666666 (* y y))))
(* 0.16666666666666666 (* y (* (sin x) y))))))
double code(double x, double y) {
double tmp;
if (y <= 1.6e-5) {
tmp = sin(x);
} else if (y <= 1.4e+215) {
tmp = x + (x * (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 <= 1.6d-5) then
tmp = sin(x)
else if (y <= 1.4d+215) then
tmp = x + (x * (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 <= 1.6e-5) {
tmp = Math.sin(x);
} else if (y <= 1.4e+215) {
tmp = x + (x * (0.16666666666666666 * (y * y)));
} else {
tmp = 0.16666666666666666 * (y * (Math.sin(x) * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.6e-5: tmp = math.sin(x) elif y <= 1.4e+215: tmp = x + (x * (0.16666666666666666 * (y * y))) else: tmp = 0.16666666666666666 * (y * (math.sin(x) * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.6e-5) tmp = sin(x); elseif (y <= 1.4e+215) tmp = Float64(x + Float64(x * 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 <= 1.6e-5) tmp = sin(x); elseif (y <= 1.4e+215) tmp = x + (x * (0.16666666666666666 * (y * y))); else tmp = 0.16666666666666666 * (y * (sin(x) * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.6e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.4e+215], N[(x + N[(x * 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 1.6 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.4 \cdot 10^{+215}:\\
\;\;\;\;x + x \cdot \left(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 < 1.59999999999999993e-5Initial program 99.6%
Taylor expanded in y around 0 66.8%
if 1.59999999999999993e-5 < y < 1.4e215Initial program 100.0%
Taylor expanded in y around 0 23.5%
unpow223.5%
Simplified23.5%
Taylor expanded in x around 0 26.1%
+-commutative26.1%
unpow226.1%
fma-udef26.1%
Simplified26.1%
fma-udef26.1%
associate-*r*26.1%
*-commutative26.1%
distribute-rgt-in26.1%
*-commutative26.1%
associate-*r*26.1%
*-un-lft-identity26.1%
Applied egg-rr26.1%
if 1.4e215 < 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*85.7%
Simplified85.7%
Final simplification62.1%
(FPCore (x y)
:precision binary64
(if (<= y 1.42e-5)
(sin x)
(if (<= y 1.35e+154)
(+ x (* x (* 0.16666666666666666 (* y y))))
(* 0.16666666666666666 (* (sin x) (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 1.42e-5) {
tmp = sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.16666666666666666 * (y * y)));
} else {
tmp = 0.16666666666666666 * (sin(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 <= 1.42d-5) then
tmp = sin(x)
else if (y <= 1.35d+154) then
tmp = x + (x * (0.16666666666666666d0 * (y * y)))
else
tmp = 0.16666666666666666d0 * (sin(x) * (y * y))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.42e-5) {
tmp = Math.sin(x);
} else if (y <= 1.35e+154) {
tmp = x + (x * (0.16666666666666666 * (y * y)));
} else {
tmp = 0.16666666666666666 * (Math.sin(x) * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.42e-5: tmp = math.sin(x) elif y <= 1.35e+154: tmp = x + (x * (0.16666666666666666 * (y * y))) else: tmp = 0.16666666666666666 * (math.sin(x) * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.42e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))); else tmp = Float64(0.16666666666666666 * Float64(sin(x) * Float64(y * y))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.42e-5) tmp = sin(x); elseif (y <= 1.35e+154) tmp = x + (x * (0.16666666666666666 * (y * y))); else tmp = 0.16666666666666666 * (sin(x) * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.42e-5], N[Sin[x], $MachinePrecision], If[LessEqual[y, 1.35e+154], N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.16666666666666666 * N[(N[Sin[x], $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.42 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{+154}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(\sin x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.42e-5Initial program 99.6%
Taylor expanded in y around 0 66.8%
if 1.42e-5 < y < 1.35000000000000003e154Initial program 100.0%
Taylor expanded in y around 0 5.0%
unpow25.0%
Simplified5.0%
Taylor expanded in x around 0 11.3%
+-commutative11.3%
unpow211.3%
fma-udef11.3%
Simplified11.3%
fma-udef11.3%
associate-*r*11.3%
*-commutative11.3%
distribute-rgt-in11.3%
*-commutative11.3%
associate-*r*11.3%
*-un-lft-identity11.3%
Applied egg-rr11.3%
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-*l*83.4%
Simplified83.4%
Taylor expanded in y around 0 100.0%
unpow2100.0%
*-commutative100.0%
Simplified100.0%
Final simplification63.9%
(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 99.7%
Taylor expanded in y around 0 75.1%
unpow275.1%
Simplified75.1%
Final simplification75.1%
(FPCore (x y) :precision binary64 (if (<= y 1.6e-5) (sin x) (+ x (* x (* 0.16666666666666666 (* y y))))))
double code(double x, double y) {
double tmp;
if (y <= 1.6e-5) {
tmp = sin(x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 1.6d-5) then
tmp = sin(x)
else
tmp = x + (x * (0.16666666666666666d0 * (y * y)))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 1.6e-5) {
tmp = Math.sin(x);
} else {
tmp = x + (x * (0.16666666666666666 * (y * y)));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.6e-5: tmp = math.sin(x) else: tmp = x + (x * (0.16666666666666666 * (y * y))) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.6e-5) tmp = sin(x); else tmp = Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.6e-5) tmp = sin(x); else tmp = x + (x * (0.16666666666666666 * (y * y))); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.6e-5], N[Sin[x], $MachinePrecision], N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.6 \cdot 10^{-5}:\\
\;\;\;\;\sin x\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.59999999999999993e-5Initial program 99.6%
Taylor expanded in y around 0 66.8%
if 1.59999999999999993e-5 < y Initial program 100.0%
Taylor expanded in y around 0 52.5%
unpow252.5%
Simplified52.5%
Taylor expanded in x around 0 42.0%
+-commutative42.0%
unpow242.0%
fma-udef42.0%
Simplified42.0%
fma-udef42.0%
associate-*r*42.0%
*-commutative42.0%
distribute-rgt-in42.0%
*-commutative42.0%
associate-*r*42.0%
*-un-lft-identity42.0%
Applied egg-rr42.0%
Final simplification60.4%
(FPCore (x y) :precision binary64 (if (<= y 1.9) x (* 0.16666666666666666 (* x (* y y)))))
double code(double x, double y) {
double tmp;
if (y <= 1.9) {
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 <= 1.9d0) 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 <= 1.9) {
tmp = x;
} else {
tmp = 0.16666666666666666 * (x * (y * y));
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.9: tmp = x else: tmp = 0.16666666666666666 * (x * (y * y)) return tmp
function code(x, y) tmp = 0.0 if (y <= 1.9) 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 <= 1.9) tmp = x; else tmp = 0.16666666666666666 * (x * (y * y)); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.9], x, N[(0.16666666666666666 * N[(x * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;0.16666666666666666 \cdot \left(x \cdot \left(y \cdot y\right)\right)\\
\end{array}
\end{array}
if y < 1.8999999999999999Initial program 99.6%
Taylor expanded in y around 0 83.0%
unpow283.0%
Simplified83.0%
Taylor expanded in x around 0 46.6%
+-commutative46.6%
unpow246.6%
fma-udef46.6%
Simplified46.6%
Taylor expanded in y around 0 32.9%
if 1.8999999999999999 < y Initial program 100.0%
Taylor expanded in y around 0 52.5%
unpow252.5%
Simplified52.5%
Taylor expanded in y around inf 52.4%
unpow252.4%
associate-*l*44.1%
Simplified44.1%
Taylor expanded in x around 0 42.0%
unpow242.0%
Simplified42.0%
Final simplification35.2%
(FPCore (x y) :precision binary64 (+ x (* x (* 0.16666666666666666 (* y y)))))
double code(double x, double y) {
return x + (x * (0.16666666666666666 * (y * y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (x * (0.16666666666666666d0 * (y * y)))
end function
public static double code(double x, double y) {
return x + (x * (0.16666666666666666 * (y * y)));
}
def code(x, y): return x + (x * (0.16666666666666666 * (y * y)))
function code(x, y) return Float64(x + Float64(x * Float64(0.16666666666666666 * Float64(y * y)))) end
function tmp = code(x, y) tmp = x + (x * (0.16666666666666666 * (y * y))); end
code[x_, y_] := N[(x + N[(x * N[(0.16666666666666666 * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + x \cdot \left(0.16666666666666666 \cdot \left(y \cdot y\right)\right)
\end{array}
Initial program 99.7%
Taylor expanded in y around 0 75.1%
unpow275.1%
Simplified75.1%
Taylor expanded in x around 0 45.4%
+-commutative45.4%
unpow245.4%
fma-udef45.4%
Simplified45.4%
fma-udef45.4%
associate-*r*45.4%
*-commutative45.4%
distribute-rgt-in45.4%
*-commutative45.4%
associate-*r*45.4%
*-un-lft-identity45.4%
Applied egg-rr45.4%
Final simplification45.4%
(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 99.7%
Taylor expanded in y around 0 75.1%
unpow275.1%
Simplified75.1%
Taylor expanded in x around 0 45.4%
+-commutative45.4%
unpow245.4%
fma-udef45.4%
Simplified45.4%
Taylor expanded in y around 0 25.0%
Final simplification25.0%
herbie shell --seed 2023290
(FPCore (x y)
:name "Linear.Quaternion:$ccos from linear-1.19.1.3"
:precision binary64
(* (sin x) (/ (sinh y) y)))