Stdlib module math/roots.vitl

This page is a wiki-style reference for one concrete stdlib file. It explains what the file owns, where it fits in the family, and how to decide whether this is the right surface to depend on.

Visual portrait of math/roots.vitl
Wiki-style portrait for math/roots.vitl.

Family: math

Kind: public stdlib surface

Page style: this reference follows the same “encyclopedic card + portrait + usage contract” logic as the keyword pages, but for stdlib modules.

Summary

Overview

FieldValue
Pathmath/roots.vitl
Familymath
Kindpublic stdlib surface
Line count737
Declared procedures53
Declared forms/picks0

`math/roots.vitl` is a public stdlib surface inside the `math` family. It should be read as one focused slice of the broader family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.

Purpose

This file should be chosen because of responsibility, not because its name “sounds close enough”. Inside the math family, it carries one focused part of the contract and keeps that responsibility separate from neighboring concerns.

  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Taxonomy

Think of this page as a generated encyclopedia entry rather than a hand-written tutorial. The goal is to show what kind of module this is, how dense it is, and what reading strategy makes sense before depending on it.

  • Large algorithm surface: this file exposes many procedures and likely acts as a domain toolkit rather than a single thin wrapper.
  • Minimal top-level dependencies: the module reads as mostly self-contained from its opening declarations.
  • Explicit export surface: the file ends with visible export declarations instead of relying only on implicit namespace discovery.

Implementation profile

This profile is inferred directly from the source text. It does not replace reading the file, but it tells you quickly whether the module is mostly declarative, loop-heavy, branch-heavy, or organized around many small exits.

SignalCountWhat it suggests
if80Branching density and local decision-making.
while12Loop-heavy or iterative implementation style.
for0Collection-style traversal at source level.
match0Variant-driven branching or grammar-style decoding.
let76Local state and intermediate value density.
give129Number of explicit exit points and result shaping.

Top-level API inventory

SurfaceItems
Proceduresabs_int, max_int, min_int, square, cube, square_le, square_eq, cube_le_non_negative, cube_eq_non_negative, pow_int, pow_le_non_negative, pow_eq_non_negative
Formsnone declared at top level
Picksnone declared at top level
Constantsnone declared at top level
Exports*

Imported surfaces

This file does not advertise a top-level `use` surface in its opening declarations. That often means it is either self-contained or an aggregation layer.

Position in family

This file is module 15 of 21 in the math family when ordered by path. By procedure count it ranks 11, and by line count it ranks 2. Those ranks are useful as rough signals of breadth, not as quality judgments.

Declaration map

The declaration map turns raw source into a scan-friendly catalog. It is useful when the file is large enough that a reader wants to orient by kinds of surfaces first.

LineNameKindRole
1vitte/stdlib/math/integerspaceDeclares the namespace that anchors this file in the stdlib tree.
11abs_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
19max_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
27min_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
35squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
39cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
43square_leprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
55square_eqprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
63cube_le_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
80cube_eq_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
101pow_intprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
121pow_le_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
152pow_eq_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
192sqrt_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
217sqrt_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
230sqrt_roundprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
247is_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
256prev_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
265next_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
278cube_root_floor_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
303cube_root_ceil_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
316cube_root_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
324cube_root_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
332cube_root_roundprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
355is_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
360prev_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
365next_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
374iroot_floor_non_negativeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
407iroot_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
433iroot_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
459iroot_roundprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
476is_perfect_powerprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
489ilog2_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
505ilog2_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
520ilog10_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
536ilog10_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
551ilog_floorprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
567ilog_ceilprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
586is_power_of_twoprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
602is_power_of_tenprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
618is_powerprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
638decimal_digitsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
646binary_digitsprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
658distance_to_prev_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
666distance_to_next_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
674distance_to_nearest_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
685distance_to_prev_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
689distance_to_next_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
693distance_to_nearest_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
704is_perfect_squareprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
708is_perfect_cubeprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
712roots_versionprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
716roots_readyprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.
720roots_selftestprocRepresents one top-level surface in the file contract and should be read as part of the module boundary.

The table is exhaustive for top-level declarations of the selected kinds. This file declares 54 matching surfaces.

Representative signatures

These signatures are shown in source order so the page keeps the feel of a reference manual, not just a keyword cloud.

  • proc abs_int(value: int) -> int { (line 11)
  • proc max_int(a: int, b: int) -> int { (line 19)
  • proc min_int(a: int, b: int) -> int { (line 27)
  • proc square(value: int) -> int { (line 35)
  • proc cube(value: int) -> int { (line 39)
  • proc square_le(candidate: int, limit: int) -> bool { (line 43)
  • proc square_eq(candidate: int, value: int) -> bool { (line 55)
  • proc cube_le_non_negative(candidate: int, limit: int) -> bool { (line 63)
  • proc cube_eq_non_negative(candidate: int, value: int) -> bool { (line 80)
  • proc pow_int(base: int, exponent: int) -> int { (line 101)
  • proc pow_le_non_negative(base: int, exponent: int, limit: int) -> bool { (line 121)
  • proc pow_eq_non_negative(base: int, exponent: int, value: int) -> bool { (line 152)
  • proc sqrt_floor(value: int) -> int { (line 192)
  • proc sqrt_ceil(value: int) -> int { (line 217)
  • proc sqrt_round(value: int) -> int { (line 230)
  • proc is_square(value: int) -> bool { (line 247)
  • proc prev_square(value: int) -> int { (line 256)
  • proc next_square(value: int) -> int { (line 265)

The list is intentionally capped here; the source file declares 53 matching signatures in total.

How to use this module

Start by reading the file as an ownership boundary. Ask three questions: what enters this module, what stable types or procedures it exports, and what adjacent module should stay outside of it.

  1. Read space and top-level imports first so the ownership boundary of math/roots.vitl is explicit.
  2. Traverse procedures in source order; the early helpers usually explain the naming and numeric conventions used later.
  3. Use the source landmarks section below as a table of contents when the file is large.
  4. Only after that compare neighbor modules, because the right boundary choice matters more than memorizing one helper name.

User example

This example is generated from the actual stdlib module surface. Its job is not to be the smallest snippet possible; its job is to show a realistic consumer-shaped file that exercises the module and mirrors the language keywords the module itself relies on.

space demo/math_roots
proc run_example() -> string {
  let result = abs_int(1)
  let ready: bool = square_le(1, 1)
  let failed: bool = false
  let stable: bool = ready and true
  let fallback: bool = ready or false
  let idx: int = 0
  while idx < 1 {
    set idx = idx + 1
  }
  if ready {
    give "not-ready"
  } else {
    give "ok"
  }
}
export run_example

Keyword coverage

This table makes the “all keywords of the module” requirement auditable. It compares the detected Vitte keywords in the source file with the generated consumer example above.

KeywordPresent in module sourceUsed in generated user example
spaceyesyes
procyesyes
letyesyes
setyesyes
ifyesyes
elseyesyes
whileyesyes
giveyesyes
exportyesyes
trueyesyes
falseyesyes
andyesyes
oryesyes

The generated snippet exercises every detected Vitte keyword used by this module.

Source shape

space vitte/stdlib/math/integer
proc abs_int(value: int) -> int {
  if value < 0 {
    give -value
  } else {
    give value
  }
}
proc max_int(a: int, b: int) -> int {
  if a > b {

The excerpt is not meant to replace the file. It exists to make the module recognizable at first glance, the same way a Wikipedia infobox helps the reader orient before reading the whole article.

Source landmarks

Large files are easier to retain when they have visible landmarks. When the source contains explicit section banners, they are surfaced here; otherwise the first major declarations are used as anchors.

  • Integer mathematics — roots, logs, powers, digit helpers
  • Internal helpers
  • Integer square roots
  • Integer cube roots
  • Generic integer roots
  • Integer logarithms
  • Power predicates
  • Digit helpers
  • Distance helpers
  • Public aliases

Source organization

When a file carries its own internal chaptering, those chapters usually reveal the intended reading order better than a flat symbol list. This section reconstructs that organization from the source itself.

Opening declarations

Top-level items: 1. Procedures: 0. Data surfaces: 0. Constants: 0.

First visible names: vitte/stdlib/math/integer

Internal helpers

Top-level items: 12. Procedures: 12. Data surfaces: 0. Constants: 0.

First visible names: abs_int, max_int, min_int, square, cube, square_le, square_eq, cube_le_non_negative, cube_eq_non_negative, pow_int

Integer square roots

Top-level items: 6. Procedures: 6. Data surfaces: 0. Constants: 0.

First visible names: sqrt_floor, sqrt_ceil, sqrt_round, is_square, prev_square, next_square

Integer cube roots

Top-level items: 8. Procedures: 8. Data surfaces: 0. Constants: 0.

First visible names: cube_root_floor_non_negative, cube_root_ceil_non_negative, cube_root_floor, cube_root_ceil, cube_root_round, is_cube, prev_cube, next_cube

Generic integer roots

Top-level items: 5. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: iroot_floor_non_negative, iroot_floor, iroot_ceil, iroot_round, is_perfect_power

Integer logarithms

Top-level items: 6. Procedures: 6. Data surfaces: 0. Constants: 0.

First visible names: ilog2_floor, ilog2_ceil, ilog10_floor, ilog10_ceil, ilog_floor, ilog_ceil

Power predicates

Top-level items: 3. Procedures: 3. Data surfaces: 0. Constants: 0.

First visible names: is_power_of_two, is_power_of_ten, is_power

Digit helpers

Top-level items: 2. Procedures: 2. Data surfaces: 0. Constants: 0.

First visible names: decimal_digits, binary_digits

Distance helpers

Top-level items: 6. Procedures: 6. Data surfaces: 0. Constants: 0.

First visible names: distance_to_prev_square, distance_to_next_square, distance_to_nearest_square, distance_to_prev_cube, distance_to_next_cube, distance_to_nearest_cube

Public aliases

Top-level items: 6. Procedures: 5. Data surfaces: 0. Constants: 0.

First visible names: is_perfect_square, is_perfect_cube, roots_version, roots_ready, roots_selftest, *

Complete API catalog

This catalog is the exhaustive file-level index for the module. It is intentionally closer to a generated encyclopedia appendix than to a tutorial summary.

Procedures

LineNameSignatureRole
11abs_intproc abs_int(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
19max_intproc max_int(a: int, b: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
27min_intproc min_int(a: int, b: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
35squareproc square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
39cubeproc cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
43square_leproc square_le(candidate: int, limit: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
55square_eqproc square_eq(candidate: int, value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
63cube_le_non_negativeproc cube_le_non_negative(candidate: int, limit: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
80cube_eq_non_negativeproc cube_eq_non_negative(candidate: int, value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
101pow_intproc pow_int(base: int, exponent: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
121pow_le_non_negativeproc pow_le_non_negative(base: int, exponent: int, limit: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
152pow_eq_non_negativeproc pow_eq_non_negative(base: int, exponent: int, value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
192sqrt_floorproc sqrt_floor(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
217sqrt_ceilproc sqrt_ceil(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
230sqrt_roundproc sqrt_round(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
247is_squareproc is_square(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
256prev_squareproc prev_square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
265next_squareproc next_square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
278cube_root_floor_non_negativeproc cube_root_floor_non_negative(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
303cube_root_ceil_non_negativeproc cube_root_ceil_non_negative(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
316cube_root_floorproc cube_root_floor(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
324cube_root_ceilproc cube_root_ceil(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
332cube_root_roundproc cube_root_round(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
355is_cubeproc is_cube(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
360prev_cubeproc prev_cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
365next_cubeproc next_cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
374iroot_floor_non_negativeproc iroot_floor_non_negative(value: int, degree: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
407iroot_floorproc iroot_floor(value: int, degree: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
433iroot_ceilproc iroot_ceil(value: int, degree: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
459iroot_roundproc iroot_round(value: int, degree: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
476is_perfect_powerproc is_perfect_power(value: int, degree: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
489ilog2_floorproc ilog2_floor(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
505ilog2_ceilproc ilog2_ceil(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
520ilog10_floorproc ilog10_floor(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
536ilog10_ceilproc ilog10_ceil(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
551ilog_floorproc ilog_floor(value: int, base: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
567ilog_ceilproc ilog_ceil(value: int, base: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
586is_power_of_twoproc is_power_of_two(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
602is_power_of_tenproc is_power_of_ten(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
618is_powerproc is_power(value: int, base: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
638decimal_digitsproc decimal_digits(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
646binary_digitsproc binary_digits(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
658distance_to_prev_squareproc distance_to_prev_square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
666distance_to_next_squareproc distance_to_next_square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
674distance_to_nearest_squareproc distance_to_nearest_square(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
685distance_to_prev_cubeproc distance_to_prev_cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
689distance_to_next_cubeproc distance_to_next_cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
693distance_to_nearest_cubeproc distance_to_nearest_cube(value: int) -> int {Represents one top-level surface in the file contract and should be read as part of the module boundary.
704is_perfect_squareproc is_perfect_square(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
708is_perfect_cubeproc is_perfect_cube(value: int) -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
712roots_versionproc roots_version() -> string {Represents one top-level surface in the file contract and should be read as part of the module boundary.
716roots_readyproc roots_ready() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.
720roots_selftestproc roots_selftest() -> bool {Represents one top-level surface in the file contract and should be read as part of the module boundary.

Exports

LineNameSignatureRole
737*export *Re-exports surfaces that the module wants to expose as part of its public boundary.

Integration boundaries

Within math, this file should remain focused. If a future helper changes the host boundary, scheduling boundary, or data-shape boundary, it probably belongs in a neighbor module instead of being added here by convenience.

  • Family responsibility: Arithmetic, algebra, comparison, calculus, geometry, modular arithmetic, number theory, probability, statistics, matrix, and vector helpers.
  • Family architecture role: Use `math` when the transformation itself is the feature. This family exists so algorithmic intent stays visible and testable.

Composition guidance

Choose this module when

  • Choose math/roots.vitl when the main question is owned by this module rather than by transport, storage, orchestration, or user-interface code.
  • A scoring engine can compute aggregates in `math` while keeping I/O and transport elsewhere.
  • A statistics or matrix chapter should explain the workflow around the computation, not just a single formula.

Pause before extending it when

  • Avoid extending this file when the new helper mostly changes the boundary to host I/O, runtime coordination, or foreign integration instead of staying inside math.
  • Check nearby modules such as math/algebra.vitl, math/arithmetic.vitl, math/arrays.vitl before adding convenience wrappers here.

Relationship table

This table keeps the page closer to a real encyclopedia entry: a module is easier to understand when compared with its nearest alternatives in the same family.

NeighborProceduresData surfacesWhy compare it
math/algebra.vitl140Shares the same family boundary but carries a distinct slice of responsibility.
math/arithmetic.vitl722Shares the same family boundary but carries a distinct slice of responsibility.
math/arrays.vitl832Shares the same family boundary but carries a distinct slice of responsibility.
math/calculus.vitl563Shares the same family boundary but carries a distinct slice of responsibility.
math/comparison.vitl470Shares the same family boundary but carries a distinct slice of responsibility.
math/complex.vitl490Shares the same family boundary but carries a distinct slice of responsibility.
math/geometry.vitl720Shares the same family boundary but carries a distinct slice of responsibility.
math/logic.vitl200Shares the same family boundary but carries a distinct slice of responsibility.

Neighbor modules