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
Post a Comment