So I'm assuming your book writes it like this:

In general it should be interpreted as

but I definitely agree that the notation is confusing and should be avoided without parentheses.

Would you mind showing us what answer you got? I should point out that the book is using a trig identity to get to the final answer.

In particular, notice that