Explorar el Código

Fixing equals-one check.

Samuel Jaffe hace 8 años
padre
commit
b08fa174bc
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  1. 2 2
      src/bigdecimal.cpp

+ 2 - 2
src/bigdecimal.cpp

@@ -142,8 +142,8 @@ bigdecimal & math::operator-=(bigdecimal & rhs, bigdecimal const & lhs) {
 }
 
 static bool all_zero(bigdecimal::data_type const & data, size_t from) {
-  for (size_t i = data.size() - from; i < data.size(); ++i) {
-    if (data[i] != 0) return false;
+  for (size_t i = from; i > 0; --i) {
+    if (data[i-1] != 0) return false;
   }
   return true;
 }