Skip to content

Commit

Permalink
Renamed ration ToDouble() to Float64()
Browse files Browse the repository at this point in the history
  • Loading branch information
asticode committed Jan 26, 2024
1 parent 27ef0bb commit cc9ebd8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rational.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions rational_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

0 comments on commit cc9ebd8

Please sign in to comment.