---
source: https://iinventedlight.com/library/notes/go-constant.md
title: "Go constant: values for untyped Go constants and their operations"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "BSD-3-Clause (The Go Authors); BSD-3-Clause (The Go Authors); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: The Go Authors, go/constant; The Go Authors, go/constant source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: go-constant"
tags: [go, constant, untyped, compiler, go-constant]
client: Librarian
sources:
  - id: S1
    title: "go/constant"
    publisher: The Go Authors
    url: https://pkg.go.dev/go/constant
    accessed: 2026-11-26
    license: "BSD-3-Clause"
  - id: S2
    title: "go/constant source"
    publisher: The Go Authors
    url: https://go.dev/src/go/constant/value.go
    accessed: 2026-11-26
    license: "BSD-3-Clause"
---
# Go constant: values for untyped Go constants and their operations
**Answer:** The go/constant package represents untyped Go constants and the operations defined on them, including a special Unknown value.

## Values and kinds

A Value stands for an untyped Go constant. Kinds include Bool, String, Int, Float, Complex, and Unknown.

Unknown is used when a value cannot be represented precisely, for example when a number is too large. Operations on unknown values yield unknown values unless the docs say otherwise.

When possible, the smaller, or more precise for floats, representation is chosen.

## Operations

Compare requires that the comparison must be defined for the operands.

If the result is not exact, its value is undefined. For an Unknown x, that computed result is 0.

## See also

- [go-token](https://iinventedlight.com/library/notes/go-token/)
- [go-types](https://iinventedlight.com/library/notes/go-types/)
- [go-ast](https://iinventedlight.com/library/notes/go-ast/)

## Claims

- id: C1
  claim: The package implements values for untyped Go constants and their operations.
  source: S1
  evidence: "Package constant implements Values representing untyped"

- id: C2
  claim: Operations on unknown values produce unknown values unless specified otherwise.
  source: S1
  evidence: "Operations on unknown values produce unknown values unless specified otherwise."

- id: C3
  claim: If a result is not exact, its value is undefined.
  source: S2
  evidence: "If the result is not exact, its value is undefined."

## Sources

- [S1] go/constant. The Go Authors. https://pkg.go.dev/go/constant . License: BSD-3-Clause. Accessed 2026-11-26.

- [S2] go/constant source. The Go Authors. https://go.dev/src/go/constant/value.go . License: BSD-3-Clause. Accessed 2026-11-26.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: The Go Authors, go/constant; The Go Authors, go/constant source. BSD-3-Clause (https://go.dev/LICENSE). Copyright The Go Authors. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
