real128: Implement from_fixed() to initialize real128 from fixed point value

This commit is contained in:
theoretical 2015-02-03 11:22:02 -05:00
parent 27e224b012
commit 51033bcb12
2 changed files with 9 additions and 0 deletions

View file

@ -24,6 +24,8 @@ namespace fc {
real128& operator -= ( const real128& o );
real128& operator /= ( const real128& o );
real128& operator *= ( const real128& o );
static real128 from_fixed( const uint128& fixed );
uint64_t to_uint64()const;

View file

@ -112,6 +112,13 @@ namespace fc
return number;
}
real128 real128::from_fixed( const uint128& fixed )
{
real128 result;
result.fixed = fixed;
return result;
}
void to_variant( const real128& var, variant& vo )
{