Why doesn't this macro that looks at the best value of long double work?

the first one shows garbled, and the second one is all zero.

-sharpinclude<float.h>
-sharpinclude<stdio.h>
int main()
{
    printf("%.10e",LDBL_MAX);
    puts("");
    printf("%.10e",LDBL_MIN);
    return 0;
}
C
Apr.03,2021

you did not give the system, compiler and other information you use, why the garbled code is not easy to say.

but one thing is certain: it must be wrong for you to use% e to output long double, but you should use% Le or% LE, because% e corresponds to double


shouldn't you use

printf("%jx\n",LDBL_MAX);

is this the way to write it?

Menu