I have a _Float16 half-precision variable named x in my C program, and would like to printf() it. Now, I can write: printf("%f", (double) x);, and this will work; but - can I printf x directly? Without the cast, but rather with an appropriate format specifier?
Looking for an answer regarding glibc mostly, but other C standard library implementations are also interesting.
Note: _Float16 is not automatically promoted to a double.
floattoprintf. There's only theLmodifier forlong double._Float16automatically promoted todouble(for a variadic function) without the cast?_Float16is in the current spec § H.11 7floatare promoted todouble. These are called the default argument promotions. No other conversions are performed implicitly." § 6.5 6