determine the terminate condition of Taylor’s series for sin x I have been stick in this question for a long time, it is a question about Taylor’s series for $\sin x$. 

The question required that we should explain the terminate condition of this program.I 've try this code and I think if t smaller than the round-of error corresponding s, the program will terminate.
Also for Q2, does it means the error of actual value of sin(x) and sin(x) calculated by the code? 
I am a starter of matlab and please give me some advice :)
 A: Question $(b)$ is interesting.
Let us write
$$\sin(x)=\sum_{i=0}^p \frac {(-1)^n}{(2n+1)!}x^{2n+1}+\sum_{i=p+1}^\infty \frac {(-1)^n}{(2n+1)!}x^{2n+1}$$ Since it is an alternating series, the maximum error is given by the first neglected term.
So, if you want $k$ exact significant figures, you need to find $p$ such that
$$R_p=\frac {x^{2p+3}}{(2p+3)!}\leq 10^{-k}\implies (2p+3)!  \geq x^{2p+3}\,10^k$$
Have a look at this question of mine; you will find a magnificent approximation provided by @robjohn, an eminent user on this site. Adapted to your problem, this would give
$${2p+3\sim ex\,\exp\left(W\left(\frac{2 k \log (10)-\log (2 \pi  x)}{2 e x}\right)\right)-\frac12}$$ that is to say
$${p\sim \frac {e x} 2\exp\left(W\left(\frac{2 k \log (10)-\log (2 \pi  x)}{2 e x}\right)\right)-\frac74}$$
Using it for $x=\frac \pi 6$ and $k=12$, this would give $p=4.48$ then $p=5$.
Let us try
$$R_4=\frac{ \left(\frac{\pi}{6}\right)^{11} }{11! }=2.03 \times 10^{-11} \qquad \text{while} \qquad R_5=\frac{ \left(\frac{\pi}{6}\right)^{13} }{13! }=3.57 \times 10^{-14}$$
A: Welcome to Math.SE!
For (a), you are right, the loop terminates when $s \ne s+t$, where $t$ is the next term in the series you try to add on.
For (b), you can certainly easily compute $\sin(\pi/2), \sin(11\pi/2), \ldots$ by hand and the problem asks you to compare the analytic values of the function to those that are produced by the code, as well as look at some other considerations and draw conclusions about floating-point arithmetic and power-series approximations to functions.
