August 2019
Beginner to intermediate
798 pages
17h 2m
English
In this section, you will learn how to calculate Pi with high accuracy using a standard Go package named math/big and the special purpose types offered by that package.
The name of the program that uses Bellard's formula to calculate Pi is calculatePi.go and it will be presented in four parts.
The first part of calculatePi.go follows:
package main
import (
"fmt"
"math"
"math/big"
"os"
"strconv"
)
var precision uint = 0
The precision variable holds the desired precision of the calculations, and it is made global in order to be accessible from everywhere in the program.
The second code segment of calculatePi.go ...
Read now
Unlock full access