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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -