diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format
index 2fe430f75f69bf9419489357c28b523615214a9a..23da6b008c5db7092853cd9511a594b5d724ab56 100644
--- a/libstdc++-v3/include/std/format
+++ b/libstdc++-v3/include/std/format
@@ -1490,7 +1490,7 @@ namespace __format
 	      // If the buffer is too small it's probably because of a large
 	      // precision, or a very large value in fixed format.
 	      size_t __guess = 8 + __prec;
-	      if (__fmt == chars_format::fixed) // +ddd.prec
+	      if (__fmt == chars_format::fixed && __v != 0) // +ddd.prec
 		{
 		  if constexpr (is_same_v<_Fp, float>)
 		    __guess += __builtin_log10f(__v < 0.0f ? -__v : __v);