For Programmers: Free Programming Magazines  


Home > Archive > Clipper > February 2005 > kind attn : Bill Robertson









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author kind attn : Bill Robertson
rajeev chavan

2005-02-19, 3:55 pm

Dear Bill
Thanks for atan and atan2 functions.All these functions seem to be quite
intimidating for people like me.Just one last question in arctan2 when x
= -1 and y = 0 the answer(=Pi) is in negative or positive.Cltools gives it
as negative .Your program gives it as positive.I belive your answer is
correct.Pls advice.
Thank you
With Best Wishes
Rajeev Chavan


--
Rajeev Chavan
email to : sschavan at eth dot net


bill robertson

2005-02-20, 3:55 am

rajeev chavan wrote:
> Dear Bill
> Thanks for atan and atan2 functions.All these functions seem to be quite
> intimidating for people like me.Just one last question in arctan2 when x
> = -1 and y = 0 the answer(=Pi) is in negative or positive.Cltools gives it
> as negative .Your program gives it as positive.I belive your answer is
> correct.Pls advice.


Hi Rajeev

A lot depends upon your perspective as to the sign of Pi when x = -1 and
y = 0. I believe that the most common interpretation of the sign is as
follows:

If y is zero and x is < than zero, atan2() returns Pi.
If y is -zero and x is < than zero, atan2() returns -Pi.

So the sign depends upon how y is approaching zero. If y is approaching
zero from the positive side, the value is +Pi. If y is approaching zero
from the negative side, the value is -Pi. I did notice from the source
code that cltools used the test: if(x>0,0,(if y>0, Pi, -Pi)). I
intentionally changed the test so that y must be negative for the result
to be negative which is why there is a difference. I have just now
tested this special case with Borland's and Microsoft's atan2()
functions and they also give the value as positive. If cltools wanted to
be consistent with these libraries they would need to change their test
to if(y>=0, Pi, -Pi) or how I wrote the test if(y<0, -Pi, Pi).

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
rajeev chavan

2005-02-21, 8:55 am

Dear Bill
I just don't know how to thank you for being so patient in explaining me all
the intricacies of trignometric functions.Your explanations have been truly
enlightening.In my school and college I never learned all this.It is great
to have such learned people like you on this newsgroup.
Pls accept my thanks from the bottom of my heart once again.
With Best Wishes
Rajeev Chavan

"bill robertson" <arcadia2@zoominternet.net> wrote in message
news:4218241b$1_2@127.0.0.1...
> rajeev chavan wrote:
it[color=darkred]
>
> Hi Rajeev
>
> A lot depends upon your perspective as to the sign of Pi when x = -1 and
> y = 0. I believe that the most common interpretation of the sign is as
> follows:
>
> If y is zero and x is < than zero, atan2() returns Pi.
> If y is -zero and x is < than zero, atan2() returns -Pi.
>
> So the sign depends upon how y is approaching zero. If y is approaching
> zero from the positive side, the value is +Pi. If y is approaching zero
> from the negative side, the value is -Pi. I did notice from the source
> code that cltools used the test: if(x>0,0,(if y>0, Pi, -Pi)). I
> intentionally changed the test so that y must be negative for the result
> to be negative which is why there is a difference. I have just now
> tested this special case with Borland's and Microsoft's atan2()
> functions and they also give the value as positive. If cltools wanted to
> be consistent with these libraries they would need to change their test
> to if(y>=0, Pi, -Pi) or how I wrote the test if(y<0, -Pi, Pi).
>
> ----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet

News==----
> http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+

Newsgroups
> ----= East and West-Coast Server Farms - Total Privacy via Encryption

=----


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com