diff options
Diffstat (limited to '')
-rw-r--r-- | src/number.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/number.cpp b/src/number.cpp index 328cb58..0f99792 100644 --- a/src/number.cpp +++ b/src/number.cpp | |||
@@ -404,6 +404,18 @@ void Number::set( int32_t iNum ) | |||
404 | 404 | ||
405 | void Number::divide( const Number &rhs, Number &q, Number &r ) const | 405 | void Number::divide( const Number &rhs, Number &q, Number &r ) const |
406 | { | 406 | { |
407 | if( rhs.isZero() ) | ||
408 | { | ||
409 | q = rhs; | ||
410 | r.set( 0 ); | ||
411 | return; | ||
412 | } | ||
413 | if( isZero() ) | ||
414 | { | ||
415 | q = *this; | ||
416 | r.set( 0 ); | ||
417 | return; | ||
418 | } | ||
407 | DBS( DIVIDE, Bu::println("divide: %1 / %2").arg( *this ).arg( rhs ) ); | 419 | DBS( DIVIDE, Bu::println("divide: %1 / %2").arg( *this ).arg( rhs ) ); |
408 | 420 | ||
409 | // iNumShift is how many digits we've shifted the entire equation, | 421 | // iNumShift is how many digits we've shifted the entire equation, |