• 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: NSNumber : method to return pointer to represented value
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSNumber : method to return pointer to represented value


  • Subject: Re: NSNumber : method to return pointer to represented value
  • From: "email@hidden" <email@hidden>
  • Date: Sat, 22 Feb 2014 19:28:12 +0000

On 22 Feb 2014, at 15:32, Ken Thomases <email@hidden> wrote:
>>
>
> NSDecimalNumber can represent values that are outside of the range of doubles.  So, _some_ NSDecimalNumber instances _may_ return "d" for double, but others definitely won't.
>
I don’t think so.
It is possible that this behaviour could change and yes my type hinting system would then break.
However, the current behaviour to me seems entirely self consistent.

The NSDecimalNumber header says:
- (const char *)objCType NS_RETURNS_INNER_POINTER;
    // return 'd' for double

If you look in the GNUStep sources (just a vague hint I know, nothing more) then the -objCType return is hard coded.

    NSDecimalNumber *maxd = [NSDecimalNumber maximumDecimalNumber] ;
    NSDecimalNumber *mind = [NSDecimalNumber minimumDecimalNumber] ;

    printf("Max double %e \n", DBL_MAX);

    double dmax, dmin;
    [maxd getValue:&dmax];
    [mind getValue:&dmin];

    NSLog(@"max decimal %@ encoding = %s %f", maxd, [maxd objCType], dmax);	// d
    NSLog(@"max decimal %@ encoding = %s %f", mind, [mind objCType], dmim);	// d


All the best

Jonathan
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: NSNumber : method to return pointer to represented value
      • From: Ken Thomases <email@hidden>
References: 
 >NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Fritz Anderson <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Ken Thomases <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Ken Thomases <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: "email@hidden" <email@hidden>)
 >Re: NSNumber : method to return pointer to represented value (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: NSNumber : method to return pointer to represented value
  • Next by Date: Re: Disabling screen capture
  • Previous by thread: Re: NSNumber : method to return pointer to represented value
  • Next by thread: Re: NSNumber : method to return pointer to represented value
  • Index(es):
    • Date
    • Thread