User Tools

Site Tools


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.

ObjC Sourcecode Example

    //** 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]);

Output for this example code

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

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
objective-c/foundation.framework/nsnumber.h/floatvalue.txt · Last modified: 2024/02/16 01:12 (external edit)

Impressum Datenschutz