Sample code:
void print_f( float f )
{
...
}
int main( void )
{
print_f( 1.0f ); // prints 1.0
print_f( 29.0f ); // prints 29.0
print_f( 29.13f ); // prints 0x1.d2147ap+4
print_f( 256.0f ); // prints 256.0
print_f( 256.1f ); // prints 0x1.00199ap+8
// and so on
return 0;
}
I.e. if the floating constant cannot be printed precisely using %f
, then %a
is used.
Question: what is the condition for "the floating constant cannot be printed precisely using %f
"?