Message-ID: <386AF6BF.EEBC8910@earthlink.net> From: Martin Ambuhl X-Mailer: Mozilla 4.7 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: Inverse trigonometry functions in Djgpp References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Lines: 55 NNTP-Posting-Host: 209.246.108.140 X-Complaints-To: abuse AT earthlink DOT net X-Trace: newsread1.prod.itd.earthlink.net 946534026 209.246.108.140 (Wed, 29 Dec 1999 22:07:06 PST) NNTP-Posting-Date: Wed, 29 Dec 1999 22:07:06 PST Organization: EarthLink Network, Inc. X-ELN-Date: Wed Dec 29 22:07:07 1999 X-ELN-Insert-Date: Wed Dec 29 22:07:07 1999 X-Posted-Path-Was: not-for-mail Date: Thu, 30 Dec 1999 06:07:07 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Jarkko Kähkönen" wrote: > > Atan () - don't work! > Here is a bit of my code: > > float direction; > > direction = atan ( 120 / 90 ); > printf ("%f", direction"); > > And output is this: > 0.927295 > > But with calculator it is: > tan^-1 (120 / 90) = 53.1301023... > > Is atan () right inverse tan function? Yes, although atan2() is more general: #include #include #include int main(void) { double direction, degrees; direction = atan(120. / 90); degrees = direction * 180 / M_PI; printf("atan(120./90) = %*g in radian measure\n" " (%*g degrees)\n" "What's the problem?\n", DBL_DIG + 2, direction, DBL_DIG + 2, degrees); return 0; } atan(120./90) = 0.927295 in radian measure ( 53.1301 degrees) What's the problem? -- Martin Ambuhl mambuhl AT earthlink DOT net What one knows is, in youth, of little moment; they know enough who know how to learn. - Henry Adams A thick skin is a gift from God. - Konrad Adenauer __________________________________________________________ Fight spam now! Get your free anti-spam service: http://www.brightmail.com