floating

Luna-Flow/floating is arbitrary-precision floating-point arithmetic for MoonBit: binary values with IEEE 754 semantics at any precision, IEEE 754 and General Decimal Arithmetic decimals, and certified interval (ball) arithmetic following IEEE 1788. Precision, rounding, exponent range, special values, status flags, traps and enclosures are explicit values in every API rather than hidden global state. This manual documents the current branch; the current release is 0.8.0.

Install

moon add Luna-Flow/floating@0.8.0

Then import the packages you need in your moon.pkg, for example "Luna-Flow/floating/bin_float". The module needs the MoonBit toolchain 0.10 or later (moonc ≥ 0.10). It depends on Luna-Flow/arithmetic (rounding modes, contexts, checked and contextual traits) and Luna-Flow/luna-generic (algebraic traits); add Luna-Flow/arithmetic yourself when you name its types. Getting started walks through the first program.

Guides

GuideRead it for
Getting startedchoosing a package, installing, first values, contexts and failure models
Numeric semanticsthe shared vocabulary: exact value and rounded result, rounding functions, ulp and unit roundoff, flags, quantum, signed zero, NaN, enclosures
Architecturepackage layers, the numeric core pipeline, certified elementary functions, invariants
Verificationthe gates, the published conformance claims and how to reproduce them
Performance auditproofs and evidence for the optimized arithmetic paths
Repository conventionsdocumentation rules and the review checklist

Package map

Each package has a tutorial (how to use it), an API reference (what you can call) and a design page (why it works this way). The four numerical cores also have conformance and performance pages.

Numerical cores

PackagePurposePages
bin_floatarbitrary-precision binary floating point, IEEE 754 binary operations and binary16/32/64/128 interchangetutorial · API · design · conformance · performance
decimalIEEE 754 arbitrary-precision decimal with per-operation flags and DPD/BID interchangetutorial · API · design · conformance · performance
decimal_gdaGeneral Decimal Arithmetic with sticky status and trapstutorial · API · design · conformance · performance
ball_floatoutward-rounded bare and decorated intervals (IEEE 1788)tutorial · API · design · conformance · performance

Composition and shared vocabulary

PackagePurposePages
defSign, PartialOrder, the Floating trait, predicates and re-exported arithmetic typestutorial · API · design
bin_float_checkedbinary pipelines that stop at the first errortutorial · API · design
decimal_checkedIEEE decimal pipelines that accumulate flagstutorial · API · design
decimal_gda_checkedGDA pipelines that thread status and stop at trapstutorial · API · design
ball_float_checkedinterval pipelines that stop at the first errortutorial · API · design
semanticexact, representation-independent projection for cross-package comparisontutorial · API · design

Expressions and corpus frontends

PackagePurposePages
numeric_exprhost-independent numeric expression syntax and evaluationtutorial · API · design
frontend/gda_exprparse and execute GDA .decTest filestutorial · API · design
frontend/itl_exprparse and execute ITF1788 interval test rowstutorial · API · design
frontend/mpfr_exprparse and execute pinned MPFR witnessestutorial · API · design
frontend/testfloat_exprparse and execute Berkeley TestFloat vectorstutorial · API · design

Conformance command line

PackagePurposePages
clinative dispatcher for the four conformance backendstutorial · API · design
cli/gda_expr_clifile and output adapter for .decTest runstutorial · API · design
cli/itl_expr_clifile and JSON adapter for ITF1788 runstutorial · API · design
cli/mpfr_expr_clicommand adapter for MPFR witness runstutorial · API · design
cli/testfloat_expr_clicommand adapter for TestFloat runstutorial · API · design

Infrastructure and evidence

PackagePurposePages
internalshared exact-rational, big-integer, parsing, normalization and rounding helperstutorial · API · design
internal/conformancesource locations, deterministic shards, case dispositions and summariestutorial · API · design
internal/runner_clishared CLI options, files, diagnostics and JSONtutorial · API · design
consistencywhite-box cross-package laws and API auditstutorial · API · design
doc_examplesexecutable documentation examples run by just docstutorial · API · design
benchshared Maremark benchmark infrastructuretutorial · API · design
bench/bin_floatbinary arithmetic and elementary-function benchmarkstutorial · API · design
bench/decimalIEEE decimal benchmarkstutorial · API · design
bench/decimal_gdaGDA decimal benchmarkstutorial · API · design
bench/ball_floatinterval arithmetic benchmarkstutorial · API · design

The application surface is the numerical cores, def and the checked wrappers; semantic and numeric_expr are provisional integration surfaces. The other packages publish interfaces because repository tools compose them, and their design pages state narrower stability promises.

Reading paths

Evidence snapshot

  • The pinned GDA official corpus passes 64,986/64,986 legal executable scalar rows, and official0 passes 16,124/16,124. The 141 # placeholder or non-scalar rows are diagnostic exclusions.
  • The binary TestFloat level-1 matrix passes 254,227,872 vectors across binary16/32/64/128, including fused multiply-add, remainder, round to integral, integer conversions and the comparison predicates, plus pinned MPFR square-root and elementary-function witnesses.
  • The strict ITF1788 aggregate passes 4,656/4,656 selected interval cases.
  • The IEEE decimal gate covers decimal32/64/128 DPD and BID encodings, flags and arithmetic on four targets.

These finite results do not imply support for every operation, every future corpus revision or every real input. Read the conformance page of a package before turning a result into a compatibility claim.

Authority

pkg.generated.mbti defines what is public, and source and tests define behaviour; if a page and the generated interface disagree, the interface wins.