I'm trying to get the integer value of an NSNumber initialized with a float and I was expecting that intValue handle the conversion (as the docs say).
#import <Foundation/Foundation.h>
#import "Fraction.h"
#import "Complex.h"
#import "ComplexMathOps.h"
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSNumber *myNum, *floatNum, *intNum;
intNum = [NSNumber numberWithInt:100];
floatNum = [NSNumber numberWithFloat:99];
myNum = [floatNum intValue];
NSLog(@"%@",myNum);
[pool drain];
return 0;
}
What am I doing wrong? What's the correct way to convert between different numeric types?