From 06e46b0e904ca279e6e397c9f9040cf0f059b930 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 19 Apr 2013 20:08:05 -0600 Subject: Corrected bugs in division scaling and string parsing. --- src/number.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/number.cpp') 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 ) aInt.clear(); aFrac.zero(); bPositive = true; + if( sNum.isEmpty() ) + return; int iPt; for( iPt = 0; iPt < sNum.getSize() && sNum[iPt] != '.'; iPt++ ) { } @@ -455,7 +457,7 @@ void Number::divide( const Number &rhs, Number &q, Number &r ) const newrhs.aInt.append( rhs.digit( j ) ); newbase.aInt.append( digit( j ) ); } - for( int j = 0; j < aInt.getSize(); j++ ) + for( int j = rhs.aInt.getSize(); j < aInt.getSize(); j++ ) { newbase.aInt.append( aInt.get( j ) ); } -- cgit v1.2.3