summaryrefslogtreecommitdiff
path: root/src/number.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/number.cpp')
-rw-r--r--src/number.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/number.cpp b/src/number.cpp
index cab7f46..cda829e 100644
--- a/src/number.cpp
+++ b/src/number.cpp
@@ -12,6 +12,8 @@ Number::Number( int iScale, int iRadix ) :
12 aInt( RadixToBits( iRadix ) ), 12 aInt( RadixToBits( iRadix ) ),
13 aFrac( aInt.getBitWidth(), iScale ) 13 aFrac( aInt.getBitWidth(), iScale )
14{ 14{
15 if( iRadix <= 1 )
16 throw Bu::ExceptionBase("Invalid radix. Radix must be > 1.");
15} 17}
16 18
17Number::Number( const Bu::String &sData, int iScale, int iRadix ) : 19Number::Number( const Bu::String &sData, int iScale, int iRadix ) :
@@ -21,6 +23,9 @@ Number::Number( const Bu::String &sData, int iScale, int iRadix ) :
21 aInt( RadixToBits( iRadix ) ), 23 aInt( RadixToBits( iRadix ) ),
22 aFrac( aInt.getBitWidth(), iScale ) 24 aFrac( aInt.getBitWidth(), iScale )
23{ 25{
26 if( iRadix <= 1 )
27 throw Bu::ExceptionBase("Invalid radix. Radix must be > 1.");
28
24 set( sData ); 29 set( sData );
25} 30}
26 31