Index: tools/fpcmp.c
===================================================================
--- tools/fpcmp.c
+++ tools/fpcmp.c
@@ -62,16 +62,23 @@
     ++Pos;
 
   // Pre-decimal digits (optional)
+  bool HasPreDecimalDigit = false;
   while (Pos < End && isDigitChar(*Pos)) {
     ++Pos;
     EndOfNumber = Pos;
+    HasPreDecimalDigit = true;
   }
 
   // Decimal separator
   if (Pos < End && *Pos == '.') {
     ++Pos;
 
-    // Post-decimal digits (require at least one when period present)
+    // Only update the end of number if we're sure if we have a number (i.e. we
+    // have seen at least one digit so far).
+    if (HasPreDecimalDigit)
+      EndOfNumber = Pos;
+
+    // Post-decimal digits (optional if we have pre-decimal digits)
     bool HasPostDecimalDigit = false;
     while (Pos < End && isDigitChar(*Pos)) {
       HasPostDecimalDigit = true;
@@ -79,7 +86,7 @@
       ++Pos;
       EndOfNumber = Pos;
     }
-    if (!HasPostDecimalDigit)
+    if (!HasPreDecimalDigit && !HasPostDecimalDigit)
       return EndOfNumber;
   }