decimal-scaled 0.4.0

Const-generic base-10 fixed-point decimals (D9/D18/D38/D76/D153/D307) with integer-only transcendentals correctly rounded to within 0.5 ULP — exact at the type's last representable place. Deterministic across every platform; no_std-friendly.
Documentation
//! D38 cube-root kernel — `mg_divide::cbrt_raw_with_signed`.
//!
//! Captures the width-level specialisation that has lived on D38: a
//! hand-tuned 384-bit cube-root path tailored to `i128` storage,
//! strictly faster than the generic wide kernel (which would widen
//! `i128 → Int512` and use the generic Newton path).
//!
//! Sign handling lives here; the underlying mg_divide function takes
//! an unsigned magnitude plus a sign flag.

use crate::support::rounding::RoundingMode;

/// D38 cube-root kernel. Sign of the input is preserved.
#[inline]
#[must_use]
pub(crate) fn cbrt(raw: i128, scale: u32, mode: RoundingMode) -> i128 {
    if raw == 0 {
        return 0;
    }
    let negative = raw < 0;
    let q = crate::algos::mg_divide::cbrt_raw_with_signed(raw.unsigned_abs(), scale, negative, mode);
    let result = q as i128;
    if negative { -result } else { result }
}