• 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
SOLVED: using long double math functions like sinl() with Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SOLVED: using long double math functions like sinl() with Cocoa


  • Subject: SOLVED: using long double math functions like sinl() with Cocoa
  • From: "Dr. Rolf Jansen" <email@hidden>
  • Date: Sat, 6 Jan 2007 12:07:46 -0200

Dear Tomas,

thank you very much for your reply.

Now, at the weekend, I had some time to dive in deep into the problem, and you are absolutely correct in that Cocoa utilizes the Carbon/fp.h math. However, in my case (SDK path: /Developer/SDKs/ MacOSX10.4u.sdk) the fp.h and ConditionalMacros.h files which are used reside at a different location:

  /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/
   CoreServices.framework/Versions/A/Frameworks/
   CarbonCore.framework/Versions/A/Headers

In order to make long double functions do work with my Cocoa application, I changed the file ConditionalMacros.h in the above given directory at the line #105 from:

    #define TYPE_LONGDOUBLE_IS_DOUBLE 1

to:

    #ifndef TYPE_LONGDOUBLE_IS_DOUBLE
      #define TYPE_LONGDOUBLE_IS_DOUBLE 1
    #endif


In addition I added in my source files in front of any #import <Cocoa/ Cocoa.h> the following definition:


    #define TYPE_LONGDOUBLE_IS_DOUBLE 0


I am aware of the problem, that the next Xcode update will quite possibly revert my fix. However, in the moment it is the most elegant and most quickly to realize solution with minmal impact on system behaviour and performance. Furthermore, I have some hope that Apple will fix this at some time in the future in a more general way.


Many thanks for pointing me to the right direction.

Best regards

Rolf

PS: Since I resolved my problem, I will go off list now.
    So, if you want to let me know something, then please
    feel free to send me a private note.


Am 04.01.2007 um 14:54 schrieb Tomas Hurka:

Hi Rolf,

On Jan 4, 2007, at 17:29, Dr. Rolf Jansen wrote:
[..]
On Thu, 04 Jan 2007 14:10:54 +0100 Tomas Hurka wrote:

On Jan 4, 2007, at 3:59 AM, E. Wing wrote:

So I'm speculating that there is something in the Foundation headers that causes sinl to be mapped to sin (perhaps some kind of #define).

Right, check
/System/Library/Frameworks/CoreServices.framework/Versions/A/
Frameworks/CarbonCore.framework/Versions/A/Headers/fp.h
for #define sinl(x)
and
/System/Library/Frameworks/CoreServices.framework/Versions/A/
Frameworks/CarbonCore.framework/Versions/A/Headers/ ConditionalMacros.h
for #define TYPE_LONGDOUBLE_IS_DOUBLE

Tomas, are you sure about this, that Cocoa utilizes the Carbon <fp.h> math and not the Standard C <math.h> math functions?
Yes, I am. Run
cc -E a.m -o a.txt
(where a.m is your example) and look for the
/System/Library/Frameworks/CoreServices.framework/Frameworks/ CarbonCore.framework/Headers/fp.h


Bye,

_______________________________________________

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


  • Follow-Ups:
    • Re: SOLVED: using long double math functions like sinl() with Cocoa
      • From: glenn andreas <email@hidden>
References: 
 >Re: using long double math functions like sinl() with Cocoa (From: "Dr. Rolf Jansen" <email@hidden>)
 >Re: using long double math functions like sinl() with Cocoa (From: Tomas Hurka <email@hidden>)

  • Prev by Date: Re: NSPopupButton with NSArrayController
  • Next by Date: Mouse clicks from NSOutlineView
  • Previous by thread: Re: using long double math functions like sinl() with Cocoa
  • Next by thread: Re: SOLVED: using long double math functions like sinl() with Cocoa
  • Index(es):
    • Date
    • Thread