File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -30,13 +30,23 @@ f5 := f1.Multiply(f2) // 1/3
30
30
f6 , err := f1.Divide (f2) // 3/4, nil
31
31
```
32
32
33
- You can also convert a fraction to a float, or vice versa, using the ` Float64 ` and ` FromFloat64 ` functions:
33
+ You can also convert a fraction to a float, or vice versa, using ` Float64 ` and ` FromFloat64 ` functions:
34
34
35
35
``` go
36
36
floatValue := f1.Float64 () // 0.5
37
37
f7 , err := fraction.FromFloat64 (0.5 ) // 1/2, nil
38
38
```
39
39
40
+ ### 🤔 Rationale
41
+ The Fraction type in go-fractions aims to provide a lightweight, primitive-like representation of fractions. As a
42
+ result, it has limitations in terms of precision and can overflow when performing certain operations. If you need a
43
+ type that can represent all rational numbers without regard for memory and CPU consumption, consider using the
44
+ ` big.Rat ` type from the standard library.
45
+
46
+ Please note that these limitations should not be an issue for most use cases, and go-fractions provides a convenient
47
+ and efficient way to work with fractions in Go. However, it is important to be aware of these limitations and choose
48
+ the appropriate type based on your specific needs.
49
+
40
50
## 📜 Documentation
41
51
For more detailed documentation and a full list of functions, see the
42
52
[ reference page] ( https://pkg.go.dev/github.com/nethruster/go-fraction ) .
You can’t perform that action at this time.
0 commit comments