www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/30/07:54:47

From: "Jarkko Kähkönen" <jarkko DOT kahkonen AT mbnet DOT fi>
Newsgroups: comp.os.msdos.djgpp
References: <wKza4.591$eq DOT 7079 AT uutiset DOT nic DOT fi> <386AF6BF DOT EEBC8910 AT earthlink DOT net>
Subject: Re: Inverse trigonometry functions in Djgpp
Lines: 50
X-Newsreader: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <hwHa4.613$eq.7331@uutiset.nic.fi>
Date: Thu, 30 Dec 1999 13:41:03 +0200
NNTP-Posting-Host: 62.236.192.76
X-Trace: uutiset.nic.fi 946553997 62.236.192.76 (Thu, 30 Dec 1999 13:39:57 EET)
NNTP-Posting-Date: Thu, 30 Dec 1999 13:39:57 EET
Organization: NIC Tietoverkot Oy - NIC Data Networks Ltd.
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 <math.h>
>#include <stdio.h>
>#include <float.h>
>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?
>
>
>
>

Thanks to everybody for solving my problem!


- Raw text -


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