summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2014-10-30 13:34:06 -0600
committerMike Buland <mike@xagasoft.com>2014-10-30 13:34:06 -0600
commit355384af24bfdb6e1346a83011daf5b5381aa2eb (patch)
tree4f0139efc3f25074eca3bd9426283629c75c7a8a
parent7026b96ec807b169f7b413056e52412ae422ea9d (diff)
downloadclic-355384af24bfdb6e1346a83011daf5b5381aa2eb.tar.gz
clic-355384af24bfdb6e1346a83011daf5b5381aa2eb.tar.bz2
clic-355384af24bfdb6e1346a83011daf5b5381aa2eb.tar.xz
clic-355384af24bfdb6e1346a83011daf5b5381aa2eb.zip
Divisors between 0 and 1 break division now.
-rw-r--r--src/number.cpp3
-rw-r--r--src/packedintarray.h1
2 files changed, 3 insertions, 1 deletions
diff --git a/src/number.cpp b/src/number.cpp
index c23466e..be9b8be 100644
--- a/src/number.cpp
+++ b/src/number.cpp
@@ -483,9 +483,10 @@ void Number::divide( const Number &rhs, Number &q, Number &r ) const
483 for(; nNum.aInt[jtop] == 0; jtop++ ) { } 483 for(; nNum.aInt[jtop] == 0; jtop++ ) { }
484// Bu::println("Computing remainder fraction from %1 to %2") 484// Bu::println("Computing remainder fraction from %1 to %2")
485// .arg( -iAnchor-1 ).arg( jtop ); 485// .arg( -iAnchor-1 ).arg( jtop );
486 r.aFrac.clear();
486 for( int j = -iAnchor-1, k = 0; j >= jtop && k < r.iScale; j--, k++ ) 487 for( int j = -iAnchor-1, k = 0; j >= jtop && k < r.iScale; j--, k++ )
487 { 488 {
488 if( j <= nNum.aInt.getSize() ) 489 if( j < nNum.aInt.getSize() )
489 { 490 {
490 r.aFrac.set( k, nNum.aInt[j] ); 491 r.aFrac.set( k, nNum.aInt[j] );
491// Bu::println("setting %1 to %2").arg( k ).arg( nNum.aInt[j] ); 492// Bu::println("setting %1 to %2").arg( k ).arg( nNum.aInt[j] );
diff --git a/src/packedintarray.h b/src/packedintarray.h
index 4ac0bc7..eb7b25a 100644
--- a/src/packedintarray.h
+++ b/src/packedintarray.h
@@ -21,6 +21,7 @@ public:
21 void set( int idx, Unit i ); 21 void set( int idx, Unit i );
22 void insert( int idx, Unit i ); 22 void insert( int idx, Unit i );
23 int getSize() const { return iCount; } 23 int getSize() const { return iCount; }
24 void setSize( int iNewSize );
24 void set( const PackedIntArray &rSrc, int iStart, int iSize ); 25 void set( const PackedIntArray &rSrc, int iStart, int iSize );
25 void set( const PackedIntArray &rSrc ); 26 void set( const PackedIntArray &rSrc );
26 void copy( int iDest, const PackedIntArray &rSrc, int iStart, int iSize ); 27 void copy( int iDest, const PackedIntArray &rSrc, int iStart, int iSize );