I use the <quadmath.h>
. With which argument type can I read my input correctly?
If I use double it looks like:
printf("enter 3 values for s, t and mt:\n");
scanf("%lf %lf %lf", &s, &t, &mt);
printf("%lf %lf %lf\n", s, t, mt);
I tried different possibilities instead of "l" for example:
scanf("%Qf %Qf %Qf", &s, &t, &mt);
or even without
scanf("%f %f %f", &s, &t, &mt);
however I get an error.
scanf
(and related functions and printf
and related functions) is not extensible. It can only parse what the standard library knows about. The C standard library comes with the operating system, not the compiler. It does not know about libquadmath, which is a compiler extension.
So you'll have to read strings and convert them separately using strtoflt128
.
Note that C++ streams can be extended to extract __float128
, but I don't see C++ interface in the quadmath library.