How it works...

The math package makes it possible to perform complex mathematical operations in Go. This recipe should be used in conjunction with this package for performing complex floating-point operations and converting between types as needed. It's worth noting that even with float64, there may still be rounding errors for certain floating-point numbers; the following recipe demonstrates some techniques for dealing with this.

The math/big section showcases a recursive Fibonacci sequence. If you modify main.go to loop well beyond 10, you'll quickly overflow int64 if it was used instead of big.Int. The big.Int package also has helper methods to convert between the big types to other types.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.122.162