ios - Objective C Converting float to integer produces strange results -


i have float has value 30 core data.

when print value using nslog 30.

nslog(@"the value of float temp %@", [self.detailitem valueforkey:@"credit"]); 

when print value casting float int strange numbers , different result each time log printed:

nslog(@"the value of float temp %d", (int)[self.detailitem valueforkey:@"credit"]);  137978864 122273424 

try

nslog(@"the value of float temp %d", [[self.detailitem valueforkey:@"credit"] intvalue]); 

Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -