Technical Help & Discussion > Website Design & Programming
Math.Cos
Hiatus:
The command Math.Cos (in VB.NET) doesn't seem to be working for me. I have:
XCompA = FormatNumber(Math.Cos(AngleA), 2) * A
The number im using (AngleA) is 62.4. It keeps showing up as 0.908191697953518. But from using my calculator, i get 0.46329603511986173188205964738969.
XCompA and AngleA are declared as Doubles. A is another number (24.1).
My main problem is that I can't get the cosine of 62.4 to work properly....
Dack:
Suggest you might want to check what format the Cos function requires ;)
Bit of a difference between radians and degrees :whistle:
Hiatus:
Ah!
lol, can u help me out a bit more? I've been lookin' for some examples on the net but I can't seem to find any. The one's I do find don't make any sense neways (to me at least...).
Sandra:
I dont know anything about VB stuff but if its standard trig then that should be fairly straight forward.
I cant find a table for doing minutes as well as degrees, only whole degrees :(
http://www.sosmath.com/tables/trigtable/trigtable.html
Cos 62 degrees is 0.46947 so 62.4 could well be 0.46329603511986173188205964738969 as you say you are getting on your calculator.
Dont know if this helps you or not ???
Dack:
XCompA = FormatNumber(Math.Cos(AngleA), 2) * A
would need to have a conversion of the AngleA value into radians i.e. divide by 180 and then multiply by PI
CONST PI = 3.14159265358979
XCompA = FormatNumber(Math.Cos((AngleA/180.0)*PI), 2) * A
Navigation
[0] Message Index
[#] Next page
Go to full version