Float Conversion Issue

Posted by user1407570 on Stack Overflow See other posts from Stack Overflow or by user1407570
Published on 2012-05-28T08:25:50Z Indexed on 2012/06/08 10:40 UTC
Read the original article Hit count: 252

I have an issue after converted a float from a string, the result of my operation is null

The NSLogs give the right value but vitesseMoyenne is equal to null

-(void)setVitesseMoyenne:(float)uneDistanceTotale:(NSString*)unTempsTotal
{
    //float tempEnFloat = [unTempsTotal floatValue];

    NSLog(@"%@",unTempsTotal);


    float calculVitesseMoyenne = uneDistanceTotale / [unTempsTotal floatValue];

    NSLog(@"%f",calculVitesseMoyenne);

    vitesseMoyenne =  [NSString stringWithFormat:@"%f", calculVitesseMoyenne];
}

Can you see what is wrong ?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about nsstring