mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 12:30:49 +01:00
Add InexactFloat64 method (#205)
* Add func (d Decimal) MustFloat64() * renames MustFloat64 to InexactFloat64
This commit is contained in:
parent
f77bb07828
commit
501661573f
1 changed files with 7 additions and 0 deletions
|
@ -804,6 +804,13 @@ func (d Decimal) Float64() (f float64, exact bool) {
|
||||||
return d.Rat().Float64()
|
return d.Rat().Float64()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// InexactFloat64 returns the nearest float64 value for d.
|
||||||
|
// It doesn't indicate if the returned value represents d exactly.
|
||||||
|
func (d Decimal) InexactFloat64() float64 {
|
||||||
|
f, _ := d.Float64()
|
||||||
|
return f
|
||||||
|
}
|
||||||
|
|
||||||
// String returns the string representation of the decimal
|
// String returns the string representation of the decimal
|
||||||
// with the fixed point.
|
// with the fixed point.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue