Might be you variable type conversion done by the compiler.  I make it a
habit to never rely on the compiler to properly type my variables and almost
always specify the type in equations.
maybe try:
cot1 = 1.0/(tan((((double)(long_diff)))/90.0 * ((double)(pi))/2.0));

----- Original Message -----
From: "Ammi Aithal" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, November 11, 2002 11:37 AM
Subject: MathLib tan() value differs from that of calculator.Any clue???


> Hi,
>
> In my PDA application, I am supposed to find the
> distance b/n lat and lon co-ordinates.
>
> While debugging the function which does the above job,
> I noticed that trignometric functions like tan()(I
> haven't tried other functions since I was stuck here)
> gives me different values when using CW compiler than
> from the standard calculator. I am using MathLib
> library for trignometric functions.
>
> Part of my code where I am getting different values is
> enclosed below.
>
>  //All variables are of type double.
>  long_diff = fabs(lon1_deg - lon2_deg)/2.0; //Absolute
> value
>  cot1 = 1/(tan((long_diff)/90 * pi/2));
>
> //cot1 value when I compile thro CW -
> 1206.226660616226
> with long_diff value 0.04749999999999943
>
> //Calculator gives me 69111.712627 which is correct
> b'cos I get the correct distance using this value.
>
> Does anybody have any clue on this behaviour.
>
> Regards,
> Ammy
>
> __________________________________________________
> Do You Yahoo!?
> Everything you'll ever need on one web page
> from News and Sport to Email and Music Charts
> http://uk.my.yahoo.com
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to