My script needs to convert degrees to radians accurately.
I was using
270 PI mul 180 div
then I found out that I need to use the quotient in the div.
As the quotient is what I'm trying to work out to use in SetImageRotation, how can I work out radians?
UPDATE: Fixed.
Self "main" GetImageRotation ->currentRotation
<-currentRotation <-mag_angle 270 PI mul 1 180 div mul sub 90 PI mul 1 180 div mul sub ->currentRotation
Self "main" <-currentRotation SetImageRotation
To convert degrees to radians you need to divide by 360 and multiply by 2 pi. In CRPL:
asfloat(<-degrees) div(360) mul(PI) mul(2) ->radians
Quote from: eduran on November 17, 2013, 06:15:33 PM
To convert degrees to radians you need to divide by 360 and multiply by 2 pi. In CRPL:
asfloat(<-degrees) div(360) mul(PI) mul(2) ->radians
I did it like
270 PI mul 1 180 div mul Because the problem with
div is that it doesn't divide the numerator by the denominator, it divides the numerator by the quotient. And the quotient was the bit I was trying to work out.
numerator = quotientdenominator