c - Return value with lots of decimal places -
c - Return value with lots of decimal places -
is there way, create function homecoming numbers 15 decimal places?
long double vzdalenost(long double a1,long double b1,long double a2,long double b2){ long double vzdal; vzdal = ((b1-a1)*(b1-a1)+(b2-a2)*(b2-a2)); return((long double) vzdal); }
as can see, i'm quite desperate, made doubles long doubles, still homecoming value has 6 decimal places though should have much more.
by default, printf
displays 6 important decimals, display 15 utilize .
precision specifier:
printf("%.15f\n", 1.0 / 3.0);
(or appears using long double
values: printf("%.15lf\n", 1.0l / 3.0l);
).
c
Comments
Post a Comment