1

I need to do division using long double, on the order of 1/10^23, however the numbers get cut off when i check them using printf. Does anyone one know how I can see the full number? For example:

long double a = 1;
long double b = 3;
printf ("%Lf", a/b );

But I get:

0.333333

For example I would like to display the full number like here

Community
  • 1
  • 1
mihajlv
  • 2,275
  • 4
  • 36
  • 59

1 Answers1

3

%f format prints with 6 digits after the decimal point. You can use %.df to print d digits. Or better yet, use %.dg to make large/small values readable as well.

cHao
  • 84,970
  • 20
  • 145
  • 172
janneb
  • 36,249
  • 2
  • 81
  • 97