Re: Trigonometric Problem, Particularly tan() Function
Re: Trigonometric Problem, Particularly tan() Function
- Subject: Re: Trigonometric Problem, Particularly tan() Function
- From: Jens Alfke <email@hidden>
- Date: Sat, 12 Jul 2008 22:06:17 -0700
On 12 Jul '08, at 9:43 PM, Patrick Walker wrote:
Everthing appears to be fine when going from 0 to 45 degrees but at
90 degrees, the tangent returns -22877334.
That's not what I get. I just compiled and ran:
printf("tan(90) = %g\n", tan(M_PI/2));
which printed:
tan(90) = 1.63312e+16
Which is not infinity, but close enough, given that π/2 can't be
represented precisely in floating-point arithmetic.
I think you need to show us the code you're using, as there seems to
be something wrong with it.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden