Re: NSNumber : method to return pointer to represented value
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