-1

i have number:

3.08

and i use this:

NSLog(@"%1.1f", self.test.value);

but console output 3.1 not 3.0 i need output 3.0 pls help...

user3546854
  • 349
  • 1
  • 4
  • 12

1 Answers1

0

That is because it is rounding up. This might work to force it to round down:

NSLog(@"%1.1f", floor(self.test.value*10f) / 10f);
allen1
  • 714
  • 5
  • 13