delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/27/13:55:50

Message-Id: <199703262024.UAA01335@mx2.rmplc.co.uk>
From: "Liam" <marl AT rmplc DOT co DOT uk>
To: <DBerry1 AT dca DOT gov DOT au>
Cc: <djgpp AT delorie DOT com>
Subject: Re: Newbie troubles with Sin and Cos
Date: Wed, 26 Mar 1997 19:34:41 -0000
MIME-Version: 1.0

The results your program and your calculator
are giving you are correct! The thing is your
program is giving you the answer in RADIANS
and your calculator in DEGREES.
If you did maths at a high level at
school then you should know the difference
To convert radians to degrees you would
use: theta*(pi/180)
so you would just change your function to:
result = sin(theta*(pi/180));
Apart from that I can't help you. There may
be somthing that changes the mode or a
seperate function for getting the sine of
theta in degrees?
Liam

----------
for instance here's the output from a simple prog I did to test my idea

Sin of 0 is 0.000000
Sin of 1 is 0.841471
Sin of 2 is 0.909297		; RADIANS
Sin of 3 is 0.141120
Sin of 4 is -0.756802

But using a calculator I get

Sin of 0 is 0
Sin of 1 is 0.017452
Sin of 2 is 0.034899		; DEGREES
Sin of 3 is 0.052335
Sin of 4 is 0.069756

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019