• 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
Re: Using math.h
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using math.h


  • Subject: Re: Using math.h
  • From: PGM <email@hidden>
  • Date: Wed, 14 Mar 2007 10:40:32 -0400

When I make a new sample project, all math.h functions work (and as far as I know all other C standard library functions), I believe that these libraries are included in the Cocoa framework. So there might be some other code of yours conflicting, do you have an object (variable) called "pow"? You can try to NSLog other math functions such as sqrt(16) or sin(3.1415) to see whether the problem is indeed due math.h not being included.

Good luck, Patrick


On 14-Mar-07, at 10:22 AM, Nelson Santos wrote:

Hi all,

I am writing a Cocoa app, and for one of my methods, I'd like to use exponential math. For example, I want to raise 10 to the power of 3 and store the result. I found the pow() function in math.h, and read the docs in the man page. So, in my code, I have something like:

double a = 10;
double b = 3;
double c = pow(a, b);

But when compiling my app, I get a compile error "called object 'pow' is not a function".

I've added #import <math.h> to the top of my .m file. But still nothing.

How do I get pow() and the other math functions to work in my Cocoa app?

Thanks.
Nelson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
40sympatico.ca


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >Using math.h (From: Nelson Santos <email@hidden>)

  • Prev by Date: Re: Using math.h
  • Next by Date: Re: NSDictionary descriptionWithLocale
  • Previous by thread: [SOLVED]Re: Using math.h
  • Next by thread: Cocoa App distribution-related design and coding.
  • Index(es):
    • Date
    • Thread