Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FLOATING

Maintainer License State

Luna-Flow/floating 0.7.1 provides arbitrary-precision binary, decimal, GDA decimal, and certified interval arithmetic for MoonBit. Precision, rounding, special values, status flags, traps, and enclosure semantics are explicit rather than hidden in process-global state.

Start Here

Install

moon add Luna-Flow/floating@0.7.1

Import only the packages used by the current MoonBit package:

import {
  "Luna-Flow/floating/bin_float"
  "Luna-Flow/floating/decimal"
  "Luna-Flow/floating/decimal_gda"
  "Luna-Flow/floating/ball_float"
}

Quick Start

///|
test "floating 0.7.1 quick start" {
  let binary = @bin_float.BinFloat::make(
    @bin_float.BinCoeff::from_uint64(3UL),
    -1,
    53,
  )
  inspect(binary.to_double(), content="1.5")

  let context = @decimal.DecimalContext::decimal64()
  let (decimal, flags) = @decimal.Decimal::from_string_ctx("12.3400", context)
  inspect(decimal.quantum(), content="-4")
  inspect(flags.has_error(), content="false")

  let interval = @ball_float.BallFloat::from_bounds(
    @bin_float.BinFloat::from_int(1, precision=53),
    @bin_float.BinFloat::from_int(2, precision=53),
  )
  inspect(interval.contains(binary), content="true")
}

The three values have different contracts: binary is one exact dyadic point, decimal retains the input quantum, and interval denotes every real value in [1, 2].

Package Guide

Requirement Package Result model Documentation
arbitrary-precision dyadic and IEEE binary interchange bin_float value or (value, BinaryFlags) API · Tutorial · Design
IEEE decimal and DPD/BID interchange decimal value or (value, DecimalFlags) API · Tutorial · Design
General Decimal Arithmetic status and traps decimal_gda GdaOutcome with defined result and next context API · Tutorial · Design · Performance
certified real enclosure and IEEE 1788 decorations ball_float bare/decorated interval, optionally with BallFlags API · Tutorial · Design · Performance
first-error binary pipeline bin_float_checked Result[BinFloat, ArithmeticError] wrapper Tutorial
accumulated IEEE decimal pipeline decimal_checked value + latest/combined flags + optional certification error Tutorial
sticky/trapping GDA pipeline decimal_gda_checked one threaded GdaOutcome Tutorial
first-error interval pipeline ball_float_checked Result[BallFloat, ArithmeticError] wrapper Tutorial
representation-independent observation semantic exact scalar/interval projection API

Parser, CLI, benchmark, consistency, and internal/* packages are repository infrastructure. See the full documentation index before depending on them as application APIs.

0.7.1 At A Glance

  • BinFloat, Decimal, and BallFloat expose certified elementary-function paths with bounded refinement and structured certification failure.
  • Binary and decimal coefficient kernels use target-specific, exact-fallback dispatch across schoolbook, Karatsuba, Toom-3, NTT, block division, and reciprocal algorithms.
  • decimal and decimal_gda are independent state models: IEEE per-operation flags are not GDA sticky status/traps.
  • ball_float covers the declared strict IEEE 1788 phases with bare/decorated intervals, critical-point/pole handling, and conservative total fallbacks.
  • Benchmarks moved into the unified bench/* Maremark hierarchy with explicit crossover and regression analysis.
  • The 0.7.1 optimization audit records exact-kernel, directed-rounding, and interval-monotonicity proofs for the optimized paths.
  • The native benchmark artifact covers all four core suites; non-monotonic auto-tune observations remain evidence only until independently replicated.

Detailed claims and exclusions live in package-local evidence pages:

Performance thresholds are implementation evidence, not API promises. Passing a pinned finite corpus does not imply support for every operation or every real input.

Development

Run the fast pull-request gate:

just pr 8

Useful focused commands:

just fmt
just docs
just gate binary 8
just gate decimal 8
just gate decimal_gda 8
just gate interval 8
just bench bin-float --target native
just bench auto-tune --target native

Use the parameterized conformance entry point for smoke fixtures, plans, pinned corpora, targets, and phases:

just conformance smoke binary
just conformance run decimal --run-target native --run-target wasm
just conformance run interval --phase trigonometric --strict-supported

Operational corpus details live under testdata/bin_float, testdata/decimal, and testdata/interval.

Before release, run the complete gate:

just ci 8

See CONTRIBUTING for contribution rules and Documentation Standard for localization/API snapshot requirements.

License

Apache-2.0. See LICENSE.

About

Arbitrary-precision binary, decimal, and ball arithmetic for MoonBit, with checked operations and explicit numeric semantics.

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages