|
@@ -105,6 +105,11 @@ struct Fixed512
|
|
496, boost::multiprecision::backends::digit_base_2, void, boost::int16_t, -16382, 16383>,
|
|
496, boost::multiprecision::backends::digit_base_2, void, boost::int16_t, -16382, 16383>,
|
|
boost::multiprecision::et_off>;
|
|
boost::multiprecision::et_off>;
|
|
|
|
|
|
|
|
+ using Float2048 = boost::multiprecision::number<
|
|
|
|
+ boost::multiprecision::backends::cpp_bin_float<
|
|
|
|
+ 2016, boost::multiprecision::backends::digit_base_2, std::allocator<void>, boost::int32_t, -16777214, 16777215>,
|
|
|
|
+ boost::multiprecision::et_off>;
|
|
|
|
+
|
|
inline Fixed512(const Float256& val)
|
|
inline Fixed512(const Float256& val)
|
|
{
|
|
{
|
|
body = Once{ val * boost::multiprecision::pow(Float256{ 2 }, 512 - 32) };
|
|
body = Once{ val * boost::multiprecision::pow(Float256{ 2 }, 512 - 32) };
|
|
@@ -115,6 +120,11 @@ struct Fixed512
|
|
body = Once{ val * boost::multiprecision::pow(Float512{ 2 }, 512 - 32) };
|
|
body = Once{ val * boost::multiprecision::pow(Float512{ 2 }, 512 - 32) };
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ inline Fixed512(const Float2048& val)
|
|
|
|
+ {
|
|
|
|
+ body = Once{ val * boost::multiprecision::pow(Float2048{ 2 }, 512 - 32) };
|
|
|
|
+ }
|
|
|
|
+
|
|
inline Fixed512(double val)
|
|
inline Fixed512(double val)
|
|
{
|
|
{
|
|
body = Once{ boost::multiprecision::pow(Float512{ 2 }, 512 - 32) * val };
|
|
body = Once{ boost::multiprecision::pow(Float512{ 2 }, 512 - 32) * val };
|
|
@@ -128,6 +138,10 @@ struct Fixed512
|
|
return boost::multiprecision::pow(Float512{ 0.5 }, 512 - 32) * Float512{ body };
|
|
return boost::multiprecision::pow(Float512{ 0.5 }, 512 - 32) * Float512{ body };
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ inline operator Float2048(void) const {
|
|
|
|
+ return boost::multiprecision::pow(Float2048{ 0.5 }, 512 - 32) * Float2048{ body };
|
|
|
|
+ }
|
|
|
|
+
|
|
inline Fixed512& operator += (const Fixed512& other) {
|
|
inline Fixed512& operator += (const Fixed512& other) {
|
|
body += other.body;
|
|
body += other.body;
|
|
return *this;
|
|
return *this;
|