[test-suite] r178957 - fpcmp catching different number of digits

Renato Golin renato.golin at linaro.org
Sat Apr 6 11:26:48 PDT 2013


Author: rengolin
Date: Sat Apr  6 13:26:47 2013
New Revision: 178957

URL: http://llvm.org/viewvc/llvm-project?rev=178957&view=rev
Log:
fpcmp catching different number of digits

teaching fpcmp to catch the case where the two number have different
number of digits (ex. 1.234 vs 1.2345), where before it would compare
the biggest number (1.2345) against the number after the smallest.

This change makes sqlite3 pass on ARM, since the FP output precision
is not specified.

Modified:
    test-suite/trunk/tools/fpcmp.c

Modified: test-suite/trunk/tools/fpcmp.c
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/tools/fpcmp.c?rev=178957&r1=178956&r2=178957&view=diff
==============================================================================
--- test-suite/trunk/tools/fpcmp.c (original)
+++ test-suite/trunk/tools/fpcmp.c Sat Apr  6 13:26:47 2013
@@ -49,7 +49,11 @@ static bool isNumberChar(char C) {
 
 static const char *BackupNumber(const char *Pos, const char *FirstChar) {
   // If we didn't stop in the middle of a number, don't backup.
-  if (!isNumberChar(*Pos)) return Pos;
+  if (!isNumberChar(*Pos) && !isNumberChar(Pos[-1])) return Pos;
+  // If we're one past the number, the two numbers can have different number
+  // of digits. Even if we're wrong, and we get the previous number, the
+  // comparison should have failed anyway.
+  if (!isNumberChar(*Pos)) Pos--;
 
   // Otherwise, return to the start of the number.
   bool HasPeriod = false;





More information about the llvm-commits mailing list