diff --git a/bigint.go b/bigint.go index 9be9e12..912bc3d 100644 --- a/bigint.go +++ b/bigint.go @@ -21,6 +21,11 @@ func (b BigInt) Int64() int64 { return int64(b) } +// Float64 returns the float64 representation of b +func (b BigInt) Float64() float64 { + return float64(b.Int64()) +} + // MarshalGQL implements the graphql.Marshaler interface found in // gqlgen, allowing the type to be marshaled by gqlgen and sent over // the wire. diff --git a/biguint.go b/biguint.go index 6031299..8bab9c2 100644 --- a/biguint.go +++ b/biguint.go @@ -21,6 +21,11 @@ func (b BigUInt) UInt64() uint64 { return uint64(b) } +// Float64 returns the float64 representation of b +func (b BigUInt) Float64() float64 { + return float64(b.UInt64()) +} + // MarshalGQL implements the graphql.Marshaler interface found in // gqlgen, allowing the type to be marshaled by gqlgen and sent over // the wire.