|
@@ -45,6 +45,16 @@ Rational::Rational(double x)
|
|
|
const unsigned long long int mantisBits = bits & 0xFFFFFFFFFFFFF;
|
|
|
unsigned long long int significant = (long long int)pow(2, 52) | mantisBits;
|
|
|
|
|
|
+ if (exponentBits == 0 and mantisBits == 0)
|
|
|
+ {
|
|
|
+ num = 0;
|
|
|
+ denum = 1;
|
|
|
+ }
|
|
|
+ else if(exponentBits == 2046)
|
|
|
+ {
|
|
|
+ throw "Rational doesn't support NaN or Inf";
|
|
|
+ }
|
|
|
+
|
|
|
const long long int sign = signBit ? -1 : 1;
|
|
|
const long long int exp = exponentBits - 1023 - 52;
|
|
|
|