diff --git a/libc/src/stdio/printf_core/converter.cpp b/libc/src/stdio/printf_core/converter.cpp --- a/libc/src/stdio/printf_core/converter.cpp +++ b/libc/src/stdio/printf_core/converter.cpp @@ -28,6 +28,23 @@ if (!to_conv.has_conv) return writer->write(to_conv.raw_string); +#ifndef LIBC_COPT_PRINTF_DISABLE_FLOAT + // TODO(michaelrj): Undo this once decimal long double support is done. + if (to_conv.length_modifier == LengthModifier::L) { + switch (to_conv.conv_name) { + case 'f': + case 'F': + case 'e': + case 'E': + case 'g': + case 'G': + return convert_float_hex_exp(writer, to_conv); + default: + break; + } + } +#endif // LIBC_COPT_PRINTF_DISABLE_FLOAT + switch (to_conv.conv_name) { case '%': return writer->write("%"); diff --git a/libc/src/stdio/printf_core/float_hex_converter.h b/libc/src/stdio/printf_core/float_hex_converter.h --- a/libc/src/stdio/printf_core/float_hex_converter.h +++ b/libc/src/stdio/printf_core/float_hex_converter.h @@ -29,9 +29,9 @@ LIBC_INLINE int convert_float_hex_exp(Writer *writer, const FormatSection &to_conv) { // All of the letters will be defined relative to variable a, which will be - // the appropriate case based on the name of the conversion. - // Since the name of the conversion is also 'a', we can just use it directly. - const char a = to_conv.conv_name; + // the appropriate case based on the name of the conversion. This converts any + // conversion name into the letter 'a' with the appropriate case. + const char a = (to_conv.conv_name & 32) | 'A'; bool is_negative; int exponent;