• 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
math.h and floats.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

math.h and floats.


  • Subject: math.h and floats.
  • From: Matthew Cox <email@hidden>
  • Date: Mon, 24 Jun 2002 17:05:58 -0400

under exp in the man pages, the following function is defined:

float
powf(float x, float, y");

Under sqrt in the man pages, the following function is defined:

float
sqrtf(float x);

After using #include "math.h" in the header file, I the following line
of code produces an error and some warnings:

dInit = sqrtf(powf([self deltaX], 2) + powf([self deltaY], 2)); //The
pythagorean theorem

Here is the error...

/usr/bin/ld: Undefined symbols:
_powf
_sqrtf

Here are the warnings...

VectorPath.m:97: warning: type mismatch in implicit declaration for
built-in function `sqrtf'
VectorPath.m:97: warning: implicit declaration of function `powf'

Why does the above statement fail? I'm assuming that math.h may not
define these symbols, even though they are in the man pages (have a look
under "man sqrt" and "man exp".) Both of these man pages tell the user
to include <math.h>

The f at the end of the functions are to differentiate them from
functions using doubles. Since the results are going into NSPoints,
using doubles wastes resources.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: math.h and floats.
      • From: "John C. Randolph" <email@hidden>
    • Re: math.h and floats.
      • From: Sherm Pendley <email@hidden>
    • Re: math.h and floats.
      • From: email@hidden
  • Prev by Date: Re: Mixing Carbon events & Cocoa
  • Next by Date: [How] Get AppLaunched and AppDied Notifications in a CFPlugin?
  • Previous by thread: Re: Mixing Carbon events & Cocoa
  • Next by thread: Re: math.h and floats.
  • Index(es):
    • Date
    • Thread