summaryrefslogtreecommitdiff
path: root/src/number.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/number.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/number.cpp b/src/number.cpp
index b7a420c..d95ab90 100644
--- a/src/number.cpp
+++ b/src/number.cpp
@@ -63,7 +63,7 @@ Number Number::operator*( const Number &rhs ) const
63// Bu::println("Pos %1").arg(j); 63// Bu::println("Pos %1").arg(j);
64 int iPos = iCarry; 64 int iPos = iCarry;
65 iCarry = 0; 65 iCarry = 0;
66 for( int k = 1-rhs.iScale; k < rhs.aInt.getSize(); k++ ) 66 for( int k = -rhs.iScale; k < rhs.aInt.getSize(); k++ )
67 { 67 {
68// if( j-k < 0 ) 68// if( j-k < 0 )
69// break; 69// break;
@@ -566,6 +566,18 @@ void Number::setScale( int iNewScale )
566 iScale = iNewScale; 566 iScale = iNewScale;
567} 567}
568 568
569int32_t Number::toInt32() const
570{
571 int32_t ret = 0;
572 int32_t ord = 1;
573 for( int j = 0; j < aInt.getSize(); j++ )
574 {
575 ret += ord * aInt.get( j );
576 ord *= iRadix;
577 }
578 return ret;
579}
580
569Number Number::add( const Number &rhs, bool bSub ) const 581Number Number::add( const Number &rhs, bool bSub ) const
570{ 582{
571 Number ret( Bu::buMax(iScale,rhs.iScale), iRadix ); 583 Number ret( Bu::buMax(iScale,rhs.iScale), iRadix );