Programming Reference/Librarys
Question & Answer
Q&A is closed
- (float)floatValue;
Returns the receiver’s value.
Return Value - The receiver’s value as datatyp, converting it as necessary.
//** Sample Datatype ** float myFloat = 1.123456f; //** Initializing NSNumber Object ** NSNumber *myFloatNumber = [[NSNumber alloc]initWithFloat:myFloat]; //** To access your value use floatValue ** if ([myFloatNumber floatValue] == 1.123456f) { NSLog(@"myFloatNumber:%@", myFloatNumber); NSLog(@"myFloat: %f", [myFloatNumber floatValue]); }
2012-07-01 15:23:05.981 NSNumberSample[402:f803] myFloatNumber:1.123456 2012-07-01 15:23:05.983 NSNumberSample[402:f803] myFloat: 1.123456