February 2018
Intermediate to advanced
340 pages
9h 43m
English
package main import ( "fmt" "math/big" ) const PI = `3.1415926535897932384626433832795028841971693 993751058209749445923078164062862089986280348253 421170679821480865132823066470938446095505822317 253594081284811174502841027019385211055596446229 4895493038196` const diameter = 3.0 const precision = 400 func main() { pi, _ := new(big.Float).SetPrec(precision).SetString(PI) d := new(big.Float).SetPrec(precision).SetFloat64(diameter) circumference := new(big.Float).Mul(pi, d) pi64, _ := pi.Float64() fmt.Printf("Circumference big.Float = %.400f\n", circumference) fmt.Printf("Circumference ...Read now
Unlock full access