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

Re: NOT solved: using long double math functions like sinl() with Cocoa


  • Subject: Re: NOT solved: using long double math functions like sinl() with Cocoa
  • From: John Stiles <email@hidden>
  • Date: Fri, 12 Jan 2007 07:35:34 -0800



Dr. Rolf Jansen wrote:
Am 12.01.2007 um 04:27 schrieb Nir Soffer:


On Jan 12, 2007, at 01:59, Dr. Rolf Jansen wrote:

#include <stdio.h>
#include <math.h>

int main (int argc, const char * argv[])
{
    printf("%f\n%Lf", sin(1.5707963267948966),    // pi/2
                     sinl(1.57079632679489661923132169163974L));
    return 0;
}

This run fine on G5. Create new Foundation tool with this main.m:

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[]) {
assert(sin(1.5707963267948966) == sinl(1.57079632679489661923132169163974L));
return 0;
}


Seems like printf formatting issue.


Best Regards,

Nir Soffer


This would also run fine at my PowerBook G4, since the "Foundation.h" includes "fp.h" which redefines the long double sinl() to the double sin(), and that gives correct results.


This was my original problem from last week, which I thought that i could solve it (see below)


FWIW, I wouldn't have expected that equality comparison to hold true even if sinl was working fine. Floating point values are rarely /equal/ when transcendentals are involved; they are merely /within a certain delta of one another/. Checking for FP equality is rarely correct.



_______________________________________________

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: 
 >NOT solved: using long double math functions like sinl() with Cocoa (From: "Dr. Rolf Jansen" <email@hidden>)
 >Re: NOT solved: using long double math functions like sinl() with Cocoa (From: Nir Soffer <email@hidden>)
 >Re: NOT solved: using long double math functions like sinl() with Cocoa (From: "Dr. Rolf Jansen" <email@hidden>)

  • Prev by Date: Re: sleep() stops working when enabling pthread_cancel()
  • Next by Date: Re: sleep() stops working when enabling pthread_cancel()
  • Previous by thread: Re: NOT solved: using long double math functions like sinl() with Cocoa
  • Next by thread: Opening an NSWindow programatically
  • Index(es):
    • Date
    • Thread