iphone - assign double to another double with 1 number after the decimal -


this question has answer here:

i want assign value of double double, print 1 number after decimal, let have random double value , 23.12906370532668

how can converted 23.1, stay double value?? say:

nslog(@"%4.1f\n", double); 

but printed string want assign new double. double 1 = 23.12906370532668; double 2 = 23.1; best way , how that?

am not sure trying do, want

double d = 23.12906370532668; nsstring *str = [nsstring stringwithformat:@"%4.1f\n", d]; double d2 = [str doublevalue]; 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -