The problem is solved. I found another version of trig.inc in post 13, and it works well for me. I have to put the word variables x,y into long variables before doing any calculations on them.