go math commonly used method

main Package 

Import ( 
 "FMT" 
 "Math"       
) 

FUNC main () { 
 I: =. 1    
 fmt.Prinln (Math.abs (float64 (I))) // absolute value 
 fmt.Println (math.Ceil (3.8)) / / rounded up integer 
 fmt.Println (math.Floor (3.6)) // rounded down 
 fmt.Println (math.Mod (11, 3) ) // take the remainder 
 fmt.Println (math.Modf (3.22)) / / rounded and fractional 
 fmt.Println (math.Pow (3, 2) ) // x power of y 
 fmt.Println (math.Sqrt (8)) // square root 
 fmt.Println (math.Cbrt (8) ) // of cubic 
 fmt.Println (Math.PI) // [pi] 
}

  

Guess you like

Origin www.cnblogs.com/xianqingsong/p/11994437.html