diff --git a/rational.go b/rational.go index 3d04bbf..ef6cf8f 100644 --- a/rational.go +++ b/rational.go @@ -37,7 +37,7 @@ func (r *Rational) SetDen(den int) { r.c.den = C.int(den) } -func (r Rational) ToDouble() float64 { +func (r Rational) Float64() float64 { if r.Num() == 0 || r.Den() == 0 { return 0 } diff --git a/rational_test.go b/rational_test.go index 9ea4ad9..79fc2b5 100644 --- a/rational_test.go +++ b/rational_test.go @@ -16,8 +16,8 @@ func TestRational(t *testing.T) { require.Equal(t, 1, r.Num()) require.Equal(t, 2, r.Den()) require.Equal(t, "1/2", r.String()) - require.Equal(t, 0.5, r.ToDouble()) + require.Equal(t, 0.5, r.Float64()) r.SetDen(0) - require.Equal(t, float64(0), r.ToDouble()) + require.Equal(t, float64(0), r.Float64()) require.Equal(t, "0", r.String()) }