• 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: Overriding libSystem's math functions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding libSystem's math functions


  • Subject: Re: Overriding libSystem's math functions
  • From: Eric Albert <email@hidden>
  • Date: Mon, 11 Dec 2006 13:26:17 -0800

On Dec 11, 2006, at 11:35 AM, Mike Blaguszewski wrote:

On Dec 11, 2006, at 2:17 PM, Greg Guerin wrote:

You could define macros for all the standard functions that call your
custom functions:
  #define sin(x)  foosin(x)
  #define cos(x)  foocos(x)

If you put those in your own local "foomath.h" header, then your code
#includes that file rather than <math.h>. Your source can still be written
as if it used the standard functions sin(), cos(), etc.

I think this is the probably the way to I'm going to have to go, as the MS Visual C++ linker is less forgiving. Though even then it seems like higher-level optimizations could cause differences between gcc and MSVC, despite forcing strict IEEE math.

I am not a math expert (or anything close to it), but I do know that IEEE-754 compliance will not give you exactly the same floating point results on all architectures. IEEE-754 guarantees floating point equivalence up to a certain level of precision. If you want floating point equality, you'll have to go with your own FP library that does all of its work outside of the hardware FP unit.


-Eric

_______________________________________________
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


References: 
 >Re: Overriding libSystem's math functions (From: Greg Guerin <email@hidden>)
 >Re: Overriding libSystem's math functions (From: Mike Blaguszewski <email@hidden>)

  • Prev by Date: RE: Overriding libSystem's math functions
  • Next by Date: Re: Overriding libSystem's math functions
  • Previous by thread: Re: Overriding libSystem's math functions
  • Next by thread: Re: Re: Overriding libSystem's math functions
  • Index(es):
    • Date
    • Thread