using math opertion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • meghla
    New Member
    • Dec 2009
    • 7

    using math opertion

    how can i use math operations in C codes;
    such as i want to calculate sin-1(sin inverse):
    for example
    angle= sin-1(b/a);
    here angle , a ,b, all are float;

    how can i write a C code using this logic;

    plz help me............. .........


    meghla
  • meghla
    New Member
    • Dec 2009
    • 7

    #2
    i got a solution ;
    it is asin();

    but i found difficulties in finding value=sin(degre e);
    for sin(45) value should be 0.707;
    but its 0.8509; its why???? how can i fix the problem????

    Comment

    • Banfa
      Recognized Expert Expert
      • Feb 2006
      • 9067

      #3
      That is because the trigonometry functions in the C maths library do not use degrees for the unit of angle. They use radians.

      If you use your calculator (or the calculator program on your computer) to calculate sin(45 radians) then you will get the value 0.8509.

      The are 2PI radians in a complete circle therefore 2PI radians = 360 degrees therefore

      sin(45 degerees) = sin(PI/4 radians) = 0.707

      You need to either work in radians or convert your degree values to radians before calling the trig functions.

      Incidentally 45 radians = ~ 2578 degrees or just over 7 full rotations.

      Comment

      Working...