|
|
@ -27,7 +27,7 @@ public: |
|
|
|
|
|
|
|
template<class srcT> |
|
|
|
constexpr Q (const srcT value) |
|
|
|
: backend{(integer_type)(value*(1<<degen))} |
|
|
|
: backend{(integer_type)(value*(p">((integer_type)1)<<degen))} |
|
|
|
{} |
|
|
|
|
|
|
|
constexpr Q () |
|
|
@ -43,7 +43,7 @@ public: |
|
|
|
|
|
|
|
constexpr bool is_negative() |
|
|
|
{ |
|
|
|
return backend&(1<<(sizeof(backend)-1)); |
|
|
|
return backend&(p">((integer_type)1)<<(sizeof(backend)-1)); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -71,7 +71,7 @@ public: |
|
|
|
|
|
|
|
constexpr Q<integer_type, fractionals>& operator/=(const Q& oth) |
|
|
|
{ |
|
|
|
backend*=1<<Q<integer_type, fractionals>::degen; |
|
|
|
backend*=p">((integer_type)1)<<Q<integer_type, fractionals>::degen; |
|
|
|
backend/=oth.backend; |
|
|
|
return *this; |
|
|
|
} |
|
|
@ -145,14 +145,14 @@ public: |
|
|
|
constexpr operator float() |
|
|
|
{ |
|
|
|
float n=backend; |
|
|
|
n/=(1<<Q<integer_type, fractionals>::degen); |
|
|
|
n/=(p">((integer_type)1)<<Q<integer_type, fractionals>::degen); |
|
|
|
return n; |
|
|
|
} |
|
|
|
|
|
|
|
constexpr operator double() |
|
|
|
{ |
|
|
|
double n=backend; |
|
|
|
n/=(1<<Q<integer_type, fractionals>::degen); |
|
|
|
n/=(p">((integer_type)1)<<Q<integer_type, fractionals>::degen); |
|
|
|
return n; |
|
|
|
} |
|
|
|
}; |
|
|
|