为了账号安全,请及时绑定邮箱和手机立即绑定

Go规范中“无符号”,“有符号”和“虚数”的含义是什么?

Go规范中“无符号”,“有符号”和“虚数”的含义是什么?

Go
慕容3067478 2022-08-01 17:04:38
在Go中,有一个部分用于数字类型,但我不太清楚某些定义。在这种情况下,“无符号”,“所有有符号的集合”,“虚构部分”是什么意思?uint8       the set of all unsigned  8-bit integers (0 to 255)uint16      the set of all unsigned 16-bit integers (0 to 65535)uint32      the set of all unsigned 32-bit integers (0 to 4294967295)uint64      the set of all unsigned 64-bit integers (0 to 18446744073709551615)int8        the set of all signed  8-bit integers (-128 to 127)int16       the set of all signed 16-bit integers (-32768 to 32767)int32       the set of all signed 32-bit integers (-2147483648 to 2147483647)int64       the set of all signed 64-bit integers (-9223372036854775808 to 9223372036854775807)float32     the set of all IEEE-754 32-bit floating-point numbersfloat64     the set of all IEEE-754 64-bit floating-point numberscomplex64   the set of all complex numbers with float32 real and imaginary partscomplex128  the set of all complex numbers with float64 real and imaginary partsbyte        alias for uint8rune        alias for int32参考资料: https://golang.org/ref/spec#Numeric_types
查看完整描述

1 回答

?
墨色风雨

TA贡献1853条经验 获得超6个赞

var x complex128 = complex(1, 2) // 1+2i

复数的最大值:complex128(1.7976931348623157e+308 + 1.7976931348623157e+308 i)

如果你熟悉复数,那么你可以理解它。否则这里 = 或iroot of (-1)i^2 = -1

无符号表示仅正数和 0。

uint64 系列0 to 18,446,744,073,709,551,615

uint32 范围0 to 4,294,967,295

和平均值 从负到正的总数范围set of signed


查看完整回答
反对 回复 2022-08-01
  • 1 回答
  • 0 关注
  • 114 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信