summaryrefslogtreecommitdiff
path: root/src/number.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2013-04-19 20:08:05 -0600
committerMike Buland <mike@xagasoft.com>2013-04-19 20:08:05 -0600
commit06e46b0e904ca279e6e397c9f9040cf0f059b930 (patch)
tree054e2ac152ffce28d98546bdabf8083887038e11 /src/number.cpp
parent7260c36973fc0ad7ff24294ff5540d64bf32c334 (diff)
downloadclic-06e46b0e904ca279e6e397c9f9040cf0f059b930.tar.gz
clic-06e46b0e904ca279e6e397c9f9040cf0f059b930.tar.bz2
clic-06e46b0e904ca279e6e397c9f9040cf0f059b930.tar.xz
clic-06e46b0e904ca279e6e397c9f9040cf0f059b930.zip
Corrected bugs in division scaling and string parsing.
Diffstat (limited to 'src/number.cpp')
-rw-r--r--src/number.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/number.cpp b/src/number.cpp
index 15cad95..f9fab26 100644
--- a/src/number.cpp
+++ b/src/number.cpp
@@ -248,6 +248,8 @@ void Number::set( const Bu::String &sNum )
248 aInt.clear(); 248 aInt.clear();
249 aFrac.zero(); 249 aFrac.zero();
250 bPositive = true; 250 bPositive = true;
251 if( sNum.isEmpty() )
252 return;
251 int iPt; 253 int iPt;
252 for( iPt = 0; iPt < sNum.getSize() && sNum[iPt] != '.'; iPt++ ) { } 254 for( iPt = 0; iPt < sNum.getSize() && sNum[iPt] != '.'; iPt++ ) { }
253 255
@@ -455,7 +457,7 @@ void Number::divide( const Number &rhs, Number &q, Number &r ) const
455 newrhs.aInt.append( rhs.digit( j ) ); 457 newrhs.aInt.append( rhs.digit( j ) );
456 newbase.aInt.append( digit( j ) ); 458 newbase.aInt.append( digit( j ) );
457 } 459 }
458 for( int j = 0; j < aInt.getSize(); j++ ) 460 for( int j = rhs.aInt.getSize(); j < aInt.getSize(); j++ )
459 { 461 {
460 newbase.aInt.append( aInt.get( j ) ); 462 newbase.aInt.append( aInt.get( j ) );
461 } 463 }