|
-
January 31st, 2011, 01:04 PM
#1
sqrt or negative zero?
Hi,
I'm having a bit trouble with this equation:
sum = pow(cos(x),2) + pow(cos(y),2);
z = acos ( sqrt ( 1 - sum ) );
so when sum == 1, it should be sqrt(1-1) i.e. sqrt(0) which should be 0..
however I get an error as .. Nan..
a little help please.. how do i tell c++ that it is 0 not -0
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|