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

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -