سؤال

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

هل كانت مفيدة؟

المحلول

%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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top