Solution (source code)

= Solution

Put $r=\sin(\pi/4)=1/\sqrt2$. The <geometric series> has first term $r$ and common ratio $-r$, with <absolute value> less than one. Therefore its <sum> is
$$
\boxed{\frac{r}{1+r}=\frac1{\sqrt2+1}=\sqrt2-1.}
$$