4

I need to print the result of a program with 20 significant figures, but I don't know how to print more than 15 figures (format long). Is there any way to achieve this?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
Jk041
  • 934
  • 1
  • 15
  • 33

1 Answers1

6

You can control the format of your output with printf, just like in C, by following this syntax with these format specifiers:

> printf('%.20f\n', pi)
3.14159265358979311600
Jaime Soto
  • 3,168
  • 1
  • 21
  • 19