• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
problem with cos ( pi/2 )
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem with cos ( pi/2 )


  • Subject: problem with cos ( pi/2 )
  • From: billmonk <email@hidden>
  • Date: Fri, 16 Jun 2006 10:07:59 -0500

Not sure if this is the right list...searching it hasn't turned up any likely entries...


When calling cos( pi/2 ), I'm getting a tiny number, rather than zero, for


cos( M_PI_2 ); // pi/2, 1.57079632679489661923 from <math.h>


I've added "-llibm" to "Other C flags", as alluded to here,

http://developer.apple.com/documentation/Darwin/Reference/ManPages/ man3/intro.3.html

but am still getting 2.6484540326036093e-14 instead of 0.


My old IM:PowerPC Numeric book, and the OS X pdf here

http://developer.apple.com/documentation/Performance/Conceptual/ Mac_OSX_Numerics/Mac_OSX_Numerics.pdf

say cos( pi/2 ) is a special case (for all the reasons given in PPCNumerics) but that an IEEE-compliant math lib should return -0.0, with the "inexact" flag set, for cos( pi/2 ).

So it looks like I'm not actually using the IEEE libm. What am I doing wrong?

As a data point, I notice Calculator.app in Degrees mode correctly gives 0 for cos( 90 ), but in Radians mode gives a tiny number for cos ( pi /2 ); a different one than I get for cos( M_PI_2 ). That's kind of weird...
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: problem with cos ( pi/2 )
      • From: Tommy Nordgren <email@hidden>
    • Re: problem with cos ( pi/2 )
      • From: Christopher Henrich <email@hidden>
  • Prev by Date: Re: 2.3 not showing SCM column in groups and files?
  • Next by Date: Re: problem with cos ( pi/2 )
  • Previous by thread: Re: turn a group into a real folder?
  • Next by thread: Re: problem with cos ( pi/2 )
  • Index(es):
    • Date
    • Thread