fixed8: add some testcases from dev, split Value functions

Add FloatValue() and rename Value() to Int64Value() for consistency.
This commit is contained in:
Roman Khimov 2019-08-23 13:35:34 +03:00
parent a861f53733
commit 20a4ad99b3
4 changed files with 36 additions and 151 deletions

View file

@ -39,8 +39,13 @@ func (f Fixed8) String() string {
return buf.String()
}
// Value returns the original value representing the Fixed8.
func (f Fixed8) Value() int64 {
// FloatValue returns the original value representing Fixed8 as float64.
func (f Fixed8) FloatValue() float64 {
return float64(f) / decimals
}
// Int64Value returns the original value representing Fixed8 as int64.
func (f Fixed8) Int64Value() int64 {
return int64(f) / decimals
}