栏目分类:
子分类:
返回
终身学习网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
终身学习网 > IT > 软件开发 > 后端开发 > Go语言

Go语言——math包

Go语言 更新时间:发布时间: 百科书网 趣学号
概述:
  1. 使⽤时需要import “math”,math包提供了基本的数学常数和数学函数。
math包中函数
  • func NaN() float64
  • func IsNaN(f float64) (is bool)
  • func Inf(sign int) float64
  • func IsInf(f float64, sign int) bool
  • func Float32bits(f float32) uint32
  • func Float32frombits(b uint32) float32
  • func Float64bits(f float64) uint64
  • func Float64frombits(b uint64) float64
  • func Signbit(x float64) bool
  • func Copysign(x, y float64) float64
  • func Ceil(x float64) float64
  • func Floor(x float64) float64
  • func Trunc(x float64) float64
  • func Modf(f float64) (int float64, frac float64)
  • func Nextafter(x, y float64) (r float64)
  • func Abs(x float64) float64
  • func Max(x, y float64) float64
  • func Min(x, y float64) float64
  • func Dim(x, y float64) float64
  • func Mod(x, y float64) float64
  • func Remainder(x, y float64) float64
  • func Sqrt(x float64) float64
  • func Cbrt(x float64) float64
  • func Hypot(p, q float64) float64
  • func Sin(x float64) float64
  • func Cos(x float64) float64
  • func Tan(x float64) float64
  • func Sincos(x float64) (sin, cos float64)
  • func Asin(x float64) float64
  • func Acos(x float64) float64
  • func Atan(x float64) float64
  • func Atan2(y, x float64) float64
  • func Sinh(x float64) float64
  • func Cosh(x float64) float64
  • func Tanh(x float64) float64
  • func Asinh(x float64) float64
  • func Acosh(x float64) float64
  • func Atanh(x float64) float64
  • func Log(x float64) float64
  • func Log1p(x float64) float64
  • func Log2(x float64) float64
  • func Log10(x float64) float64
  • func Logb(x float64) float64
  • func Ilogb(x float64) int
  • func Frexp(f float64) (frac float64, exp int)
  • func Ldexp(frac float64, exp int) float64
  • func Exp(x float64) float64
  • func Expm1(x float64) float64
  • func Exp2(x float64) float64
  • func Pow(x, y float64) float64
  • func Pow10(e int) float64
  • func Gamma(x float64) float64
  • func Lgamma(x float64) (lgamma float64, sign int)
  • func Erf(x float64) float64
  • func Erfc(x float64) float64
  • func J0(x float64) float64
  • func J1(x float64) float64
  • func Jn(n int, x float64) float64
  • func Y0(x float64) float64
  • func Y1(x float64) float64
  • func Yn(n int, x float64) float64
math包中核⼼函数介绍
  1. func IsNaN(f float64) (is bool)
    报告f是否表示⼀个NaN(Not A Number)值。
  2. func Ceil(x float64) float64
    返回不⼩于x的最⼩整数(的浮点值)
  3. func Floor(x float64) float64
    返回不⼤于x的最⼩整数(的浮点值)
  4. func Trunc(x float64) float64
    返回x的整数部分(的浮点值)。
  5. func Abs(x float64) float64
    返回x的绝对值
  6. func Max(x, y float64) float64
    返回x和y中最⼤值
  7. func Min(x, y float64) float64
    返回x和y中最⼩值
  8. func Dim(x, y float64) float64
    函数返回x-y和0中的最⼤值
  9. func Mod(x, y float64) float64
    取余运算,可以理解为 x-Trunc(x/y)*y,结果的正负号和x相同
  10. func Sqrt(x float64) float64
    返回x的⼆次⽅根
  11. func Cbrt(x float64) float64
    返回x的三次⽅根,特例如下:
  12. func Hypot(p, q float64) float64
    返回Sqrt(pp + qq)
  13. func Pow(x, y float64) float64
    返回x^y
  14. func Sin(x float64) float64
    求正弦。
  15. func Cos(x float64) float64
    求余弦。
  16. func Tan(x float64) float64
    求正切。
  17. func Log(x float64) float64
    求⾃然对数
  18. func Log2(x float64) float64
    求2为底的对数。
  19. func Log10(x float64) float64
    求10为底的对数。
转载请注明:文章转载自 www.051e.com
本文地址:http://www.051e.com/it/1065463.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 ©2023-2025 051e.com

ICP备案号:京ICP备12030808号