Commit 821625e3 authored by David Vorick's avatar David Vorick

better Float64 implementation

parent 31c546ff
Pipeline #36051720 passed with stages
in 29 minutes and 47 seconds
......@@ -99,10 +99,7 @@ func (x Currency) Equals(y Currency) bool {
// Float64 will return the types.Currency as a float64.
func (x Currency) Float64() (f64 float64, exact bool) {
one := big.NewInt(1)
var r big.Rat
r.SetFrac(&x.i, one)
return r.Float64()
return new(big.Rat).SetInt(&x.i).Float64()
}
// Equals64 returns true if x and y have the same value.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment