Other numeric types

Go also provides a complex number for advanced mathematical applications, and a few aliases for conveniences:

  • complex64: Complex number with float32 real and imaginary parts
  • complex128: Complex number with float64 real and imaginary parts
  • byte: Alias for uint8
  • rune: Alias for int32

You can define numbers in the decimal, octal, or hexadecimal format. Decimal or base-ten numbers need no prefix. Octal or base-eight numbers should be prefixed with a zero. Hexadecimal or base-sixteen numbers should be prefixed with a zero and an x.

You can read more about the octal numeral system at https://en.wikipedia.org/wiki/Octal, decimal at https://en.wikipedia.org/wiki/Decimal, and hexadecimal at https://en.wikipedia.org/wiki/Hexadecimal ...

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.