Answers for "float number golang two dots"

Go
0

float number golang two dots

x := 12.3456
fmt.Println(math.Floor(x*100)/100) // 12.34 (round down)
fmt.Println(math.Round(x*100)/100) // 12.35 (round to nearest)
fmt.Println(math.Ceil(x*100)/100)  // 12.35 (round up)
Posted by: Guest on May-12-2020

Browse Popular Code Answers by Language