Browse Source

gcc-plugin: Fix the check function in the vector_scal example.

We obviously need to check the absolute value of vector[i] - i*factor.
Cyril Roelandt 13 years ago
parent
commit
4cf27d37db
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gcc-plugin/examples/vector_scal/vector_scal.c

+ 1 - 1
gcc-plugin/examples/vector_scal/vector_scal.c

@@ -149,7 +149,7 @@ check (size_t size, float vector[size], float factor)
   size_t i;
 
   for (i = 0; i < size; i++)
-    if (vector[i] - i * factor > EPSILON)
+    if (fabs(vector[i] - i * factor) > EPSILON)
       return false;
 
   return true;