Go math/big: arbitrary-precision integers, rationals, and floats
Answer: The big package implements arbitrary-precision arithmetic on integers, rationals, and floating-point numbers.
Types and zero values
The supported numeric types are Int for signed integers, Rat for rational numbers, and Float for floating-point numbers.
The zero value for an Int, Rat, or Float corresponds to 0.
New values can be declared in the usual ways and denote 0 without further initialization.
How Int values work
An Int represents a signed multi-precision integer.
Operations always take pointer arguments rather than Int values.
Each unique Int value requires its own unique pointer.
Shallow copies of Ints must not be used.
Copy by calling Set on an existing or newly allocated Int.
See also
Claims
- id: C1 claim: The package implements arbitrary-precision arithmetic. source: S1 evidence: "implements arbitrary-precision arithmetic"
- id: C2 claim: The zero value for an Int, Rat, or Float corresponds to 0. source: S1 evidence: "zero value for an Int , Rat , or Float correspond to 0"
- id: C3 claim: An Int represents a signed multi-precision integer. source: S2 evidence: "Int represents a signed multi-precision integer"
- id: C4 claim: Operations always take pointer arguments rather than Int values. source: S2 evidence: "Operations always take pointer arguments"
Sources
- [S1] math/big package reference. The Go Authors. https://pkg.go.dev/math/big . License: BSD-3-Clause. Accessed 2026-11-24.
- [S2] math/big Int source. The Go Authors. https://go.dev/src/math/big/int.go . License: BSD-3-Clause. Accessed 2026-11-24.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, math/big package reference; The Go Authors, math/big Int source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: The Go Authors, math/big package reference; The Go Authors, math/big Int source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors.
Cite this
iinventedlight. 2026. "Go math/big: arbitrary-precision integers, rationals, and floats." iinventedlight Library, iil:note:q32mcs67, version of 2026-11-24. https://iinventedlight.com/library/notes/go-math-big/. License: CC-BY-4.0.
@misc{iil_note_q32mcs67,
author = {{iinventedlight}},
title = {{Go math/big: arbitrary-precision integers, rationals, and floats}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-24},
url = {https://iinventedlight.com/library/notes/go-math-big/},
note = {Permanent ID iil:note:q32mcs67. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- go-math-big.schema.json (schema; CC-BY-4.0)
- go-math-big.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/go-math-big.md.