O que é esse formato %g?
The double argument is converted in style f or e (or E for G conversions).
The precision specifies the number of significant digits. If the precision
is missing, 6 digits are given; if the precision is zero, it is treated
as 1. Style e is used if the exponent from its conversion is less than
-4 or greater than or equal to the precision. Trailing zeros are removed
from the fractional part of the result; a decimal point appears only if
it is followed by at least one digit.
O Formato %e (ou %E)
The double argument is rounded and converted in the style [-]d.dddedd
where there is one digit before the decimal-point character and the number
of digits after it is equal to the precision; if the precision is missing,
it is taken as 6; if the precision is zero, no decimal-point character
appears. An E conversion uses the letter E (rather than e) to introduce
the exponent. The exponent always contains at least two digits; if the
value is zero, the exponent is 00.