Table of Contents

doubleValue

 
- (double)doubleValue;
 

Returns the receiver’s value.

Return Value - The receiver’s value as datatyp, converting it as necessary.

ObjC Sourcecode Example

    //** Sample Datatype **
    double myDouble = 3.14;
 
    //** Initializing NSNumber Object **
    NSNumber *myDoubleNumber = [[NSNumber alloc]initWithDouble:myDouble];
 
    //**  To access your value use doubleValue **
    if ([myDoubleNumber doubleValue] == 3.14) {
 
        NSLog(@"myDoubleNumber: %@", myDoubleNumber);
        NSLog(@"myDouble: %f", [myDoubleNumber doubleValue]);
 
    }

Output for this example code

2012-07-01 15:14:58.563 NSNumberSample[320:f803] myDoubleNumber: 3.14
2012-07-01 15:14:58.564 NSNumberSample[320:f803] myDouble: 3.140000