1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// SPDX-FileCopyrightText: 2026 John Moxley
// SPDX-License-Identifier: MIT OR Apache-2.0
//! `cbrt_mg_divide` — D38 cube-root kernel
//! (`mg_divide::cbrt_raw_with_signed`).
//!
//! Captures the **width-bespoke specialisation** that has lived on D38
//! since before the algorithm library existed: a hand-tuned cube root on
//! a 384-bit intermediate tailored to the `Int<2>` (`i128`/`u128`)
//! storage. Strictly faster than the generic Newton kernel widening
//! `Int<2> → Int<8>` and running the generic `icbrt`.
//!
//! Genuinely width-bespoke (Q4.1b): the body is `i128`/`u128`-specific
//! 384-bit arithmetic, so it cannot be made generic over the storage
//! width without losing the intrinsic-backed path. It serves `N == 2`
//! only (the D18 `N == 1` tier widens to `Int<2>` in the policy layer
//! and reuses it).
//!
//! Signature mirrors [`crate::algos::cbrt::cbrt_newton`]: takes the raw
//! storage integer, the scale, and the rounding mode; returns the raw
//! storage integer of the cube root. Sign of the input is preserved; the
//! underlying mg_divide function takes an unsigned magnitude plus a sign
//! flag.
use crateInt;
use crateRoundingMode;
/// D38 cube-root kernel. Sign of the input is preserved.
///
/// `Int<2>` entry point: bridges the decimal storage type to the `i128`
/// core ([`cbrt_mg_divide_raw`]) at the algorithm boundary — the
/// hand-tuned 384-bit math is unchanged. `i128` does not escape this
/// module.
pub
/// `i128` core of the D38 cube-root kernel.