The math and math/big packages focus on exposing more complex mathematical operations to the Go language, such as Pow, Sqrt, and Cos. The math package itself operates predominately on float64 unless a function says otherwise. The math/big package is for numbers that are too large to represent in a 64-bit value. This recipe will show some basic usage of the math package and demonstrate how to use math/big for Fibonacci sequence.
How to do it...
The following steps cover how to write and run your application:
- From your Terminal/console application,createa new directory called~/projects/go-programming-cookbook/chapter3/math.
- Navigate to this directory.
- Run the following command:
$ go mod init github.com/PacktPublishing/Go-Programming-Cookbook-Second-Edition/chapter3/math
You should see a file calledgo.modthat...