moon
moon

Reputation: 1502

only 6 decimal places for double

I think this is a dumb question. but i cannot figure it out. Please don't shoot me. :P I want to get double value like 8.000000111333. but I can only get up to 6 decimal places. for instance

double _result = 8.000000111333;
DLog(@"%f", _result);

the console print is - 8.000000

Upvotes: 1

Views: 1454

Answers (2)

Neilvert Noval
Neilvert Noval

Reputation: 1695

Specify it with %.6f:

double _result = 8.000000111333;
DLog(@"%.6f", _result);

Upvotes: 1

dan04
dan04

Reputation: 90995

You can specify the number of decimal places in your format string, e.g., %.12f.

Upvotes: 8

Related Questions