The values returned by those commands reflect the size of the
unrotated object, that's why it doesn't change. You see, if you rotate an object 90 degrees on the X or Z axis, you also affect the Y axis of the object in the same way that you affect the physical object.
You might be able to get around this by the "fix object pivot" command. However, I had a few problems with the object size commands a while back, so this might not solve your problems.
The trigonometry can't be that hard; I'm actually quite good with trig - if you can't solve it yourself, I'll have a go for you, if you like.
Hope this helps!
"I am a living, thinking entity who was created in the sea of information."