Topic: Rad and Deg

I've been a while to play with tangent (for the tree object).
I always got a different answer on my calculator.
I just found out that the tangent is given in rad and not in deg.
on the wiki I found the command "rad2deg()", but the answer is totally different!
I have tested it with this object:

    object "tan"
    {
        state "main"
        {
            let "$x = rad2deg(tan(1))" //deg 
            let "$y = tan(1)" //rad
            textout default 0 000 "<color=ffff00>Deg_tan(1)= $x</color>"
            textout default 0 -25 "<color=ffff00>Rad_tan(1)= $y</color>"
        }
    }

the game answers are:
in deg: 89,23289
in rad: 1,55741

The calculator answers are:
in deg: 0,017455064
in rad: 1,556407725

http://ssdw.nl/forum/getforumpic.php

Re: Rad and Deg

does this problem happen if, instead of using tan(1), you use sin(1)/cos(1) in the game?

edit: wait... now I looked better at your code and you're using rad2deg on the tangent. It's not going to work.
try tan(deg2rad(1))

Last edited by Alexandre (2011-02-09 16:05:16)

Re: Rad and Deg

I had not thought of that, thanks.
sorry for this topic neutral

http://ssdw.nl/forum/getforumpic.php

Re: Rad and Deg

ssdw wrote:

I had not thought of that, thanks.
sorry for this topic

please feel free to ask when you have any questions