From 29adabb9371db01d3b2759276fd3e661af148f2c Mon Sep 17 00:00:00 2001 From: Eric Nordelo Date: Thu, 16 Jul 2026 16:51:37 +0200 Subject: [PATCH] feat: update math packages --- content/contracts-sui/1.x/api/fixed-point.mdx | 134 ++++++++++++++++-- content/contracts-sui/1.x/fixed-point.mdx | 53 ++++++- content/contracts-sui/1.x/index.mdx | 6 +- content/contracts-sui/index.mdx | 4 +- 4 files changed, 176 insertions(+), 21 deletions(-) diff --git a/content/contracts-sui/1.x/api/fixed-point.mdx b/content/contracts-sui/1.x/api/fixed-point.mdx index ae2e5454..c8540be1 100644 --- a/content/contracts-sui/1.x/api/fixed-point.mdx +++ b/content/contracts-sui/1.x/api/fixed-point.mdx @@ -9,13 +9,13 @@ The package provides two decimal fixed-point types with 9 decimals (matching Sui - `UD30x9`: unsigned, backed by `u128`. - `SD29x9`: signed (two's complement), backed by `u128`. -Each type has a base module that holds the arithmetic, comparison, and bitwise functions, and a conversion module that scales whole integers in and out of fixed-point form. +Each type has a base module that holds arithmetic, comparison, and standard-normal distribution functions, and a conversion module that scales whole integers in and out of fixed-point form. The unsigned type also exposes bitwise functions. ### `ud30x9` [toc] [#ud30x9] ```move @@ -24,7 +24,7 @@ use openzeppelin_fp_math::ud30x9; Defines the `UD30x9` unsigned decimal fixed-point type. Values represent unsigned real numbers as a `u128` scaled by `10^9`. The 9-decimal scale matches Sui coin precision and keeps offchain reasoning straightforward (`1.0` is `1_000_000_000`). -This module owns the type, raw casting helpers (`wrap` / `unwrap`), and constant constructors. Arithmetic, comparison, and bitwise operations live in [`ud30x9_base`](#ud30x9_base). Whole-integer conversions live in [`ud30x9_convert`](#ud30x9_convert). +This module owns the type, raw casting helpers (`wrap` / `unwrap`), and constant constructors. Arithmetic, comparison, bitwise, and standard-normal distribution functions live in [`ud30x9_base`](#ud30x9_base). Whole-integer conversions live in [`ud30x9_convert`](#ud30x9_convert). Types @@ -96,18 +96,19 @@ Returns the raw `u128` bits of a `UD30x9` value. ```move use openzeppelin_fp_math::ud30x9_base; ``` -Arithmetic, comparison, and bitwise functions for `UD30x9`. All entries are exported as method-style calls on `UD30x9` via `public use fun` declarations in `ud30x9`, so `x.add(y)` and `ud30x9_base::add(x, y)` are equivalent. +Arithmetic, comparison, bitwise, and standard-normal distribution functions for `UD30x9`. All entries are exported as method-style calls on `UD30x9` via `public use fun` declarations in `ud30x9`, so `x.add(y)` and `ud30x9_base::add(x, y)` are equivalent. Functions - Arithmetic: [`add`](#ud30x9_base-add), [`sub`](#ud30x9_base-sub), [`mul`](#ud30x9_base-mul), [`mul_trunc`](#ud30x9_base-mul_trunc), [`mul_away`](#ud30x9_base-mul_away), [`div`](#ud30x9_base-div), [`div_trunc`](#ud30x9_base-div_trunc), [`div_away`](#ud30x9_base-div_away), [`mod`](#ud30x9_base-mod), [`pow`](#ud30x9_base-pow), [`sqrt`](#ud30x9_base-sqrt), [`ln`](#ud30x9_base-ln), [`log2`](#ud30x9_base-log2), [`log10`](#ud30x9_base-log10), [`abs`](#ud30x9_base-abs), [`ceil`](#ud30x9_base-ceil), [`floor`](#ud30x9_base-floor), [`unchecked_add`](#ud30x9_base-unchecked_add), [`unchecked_sub`](#ud30x9_base-unchecked_sub) +- Standard-normal distributions: [`cdf`](#ud30x9_base-cdf), [`pdf`](#ud30x9_base-pdf), [`inverse_cdf`](#ud30x9_base-inverse_cdf) - Comparison: [`eq`](#ud30x9_base-eq), [`neq`](#ud30x9_base-neq), [`gt`](#ud30x9_base-gt), [`gte`](#ud30x9_base-gte), [`lt`](#ud30x9_base-lt), [`lte`](#ud30x9_base-lte), [`is_zero`](#ud30x9_base-is_zero) - Bitwise: [`and`](#ud30x9_base-and), [`and2`](#ud30x9_base-and2), [`or`](#ud30x9_base-or), [`xor`](#ud30x9_base-xor), [`not`](#ud30x9_base-not), [`lshift`](#ud30x9_base-lshift), [`unchecked_lshift`](#ud30x9_base-unchecked_lshift), [`rshift`](#ud30x9_base-rshift), [`unchecked_rshift`](#ud30x9_base-unchecked_rshift) - Cross-type casts: [`into_SD29x9`](#ud30x9_base-into_SD29x9), [`try_into_SD29x9`](#ud30x9_base-try_into_SD29x9) @@ -121,6 +122,8 @@ Errors - [`EInvalidShiftSize`](#ud30x9_base-EInvalidShiftSize) - [`ELogUndefined`](#ud30x9_base-ELogUndefined) - [`ELogResultUnrepresentable`](#ud30x9_base-ELogResultUnrepresentable) +- [`EProbabilityOutOfRange`](#ud30x9_base-EProbabilityOutOfRange) +- [`EProbabilityBelowHalf`](#ud30x9_base-EProbabilityBelowHalf) #### Functions [!toc] [#ud30x9_base-Functions] @@ -278,6 +281,43 @@ Aborts with `ELogResultUnrepresentable` if `x` is in `(0, 1)` (the result would Returns `x` unchanged. `UD30x9` is unsigned, so the absolute value is identity. Provided for symmetry with `SD29x9::abs`. + +Returns the standard-normal cumulative probability `Φ(z)` for a non-negative `z`. The result is in `[0.5, 1]`; `cdf(0)` is exactly `0.5`, and inputs at or above `6.109410205` return exactly `1`. + +The result is monotone non-decreasing between adjacent representable inputs. Its maximum absolute approximation error is at most `5 * 10^-9` (5 ULP), with an empirical worst case of approximately `5 * 10^-10` for the committed fit. + +NOTE: The function is pure and deterministic. At 9-decimal resolution, adjacent inputs can return the same quantized probability. + + + +Returns the standard-normal probability density `φ(z)` for a non-negative `z`. The result is in `[0, 0.398942280]`; `pdf(0)` is exactly `0.398942280`, and inputs at or above `6.402729806` return exactly `0`. + +The result is monotone non-increasing in `|z|`. Its maximum absolute approximation error is at most `5 * 10^-9` (5 ULP), with an empirical worst case of approximately `5 * 10^-10` for the committed fit. + +NOTE: The function is pure and deterministic. + + + +Returns the non-negative standard-normal quantile `Φ⁻¹(p)`. The unsigned representation covers `p` in `[0.5, 1]`; `inverse_cdf(0.5)` is exactly `0`, and `inverse_cdf(1)` returns the finite endpoint clamp `6.109410205`. + +Aborts with `EProbabilityBelowHalf` if `p < 0.5` because the quantile would be negative. +Aborts with `EProbabilityOutOfRange` if `p > 1`. + +NOTE: The maximum absolute approximation error is at most `5 * 10^-9` (5 ULP). Across the deterministic validation grid, no result is more than 1 ULP from the correctly rounded output. Near `p = 1`, a 1-ULP input change can produce a much larger quantile change because the mathematical function is intrinsically steep. + + + +Raised when [`inverse_cdf`](#ud30x9_base-inverse_cdf) receives a probability greater than `1`. + + + +Raised when [`inverse_cdf`](#ud30x9_base-inverse_cdf) receives a probability below `0.5`, whose quantile is negative and unrepresentable in `UD30x9`. + + ### `ud30x9_convert` [toc] [#ud30x9_convert] ```move @@ -628,7 +684,7 @@ Raised when a truncated whole part does not fit in `u64`. ```move @@ -637,7 +693,7 @@ use openzeppelin_fp_math::sd29x9; Defines the `SD29x9` signed decimal fixed-point type. Values represent signed real numbers as a two's complement `u128` scaled by `10^9`. Useful for balance deltas and any quantity that can dip below zero. -This module owns the type, raw casting helpers (`wrap` / `unwrap`), and constant constructors (`zero`, `one`, `min`, `max`). Arithmetic, comparison, and cross-type casts live in [`sd29x9_base`](#sd29x9_base). Whole-integer conversions live in [`sd29x9_convert`](#sd29x9_convert). +This module owns the type, raw casting helpers (`wrap` / `unwrap`), and constant constructors (`zero`, `one`, `min`, `max`). Arithmetic, comparison, standard-normal distribution functions, and cross-type casts live in [`sd29x9_base`](#sd29x9_base). Whole-integer conversions live in [`sd29x9_convert`](#sd29x9_convert). Types @@ -736,14 +792,14 @@ Raised when [`wrap`](#sd29x9-wrap) is called with a magnitude that exceeds `2^12 ```move use openzeppelin_fp_math::sd29x9_base; ``` -Arithmetic, comparison, and cross-type casts for `SD29x9`. All entries are exported as method-style calls on `SD29x9` via `public use fun` declarations in `sd29x9`, so `x.add(y)` and `sd29x9_base::add(x, y)` are equivalent. +Arithmetic, comparison, standard-normal distribution functions, and cross-type casts for `SD29x9`. All entries are exported as method-style calls on `SD29x9` via `public use fun` declarations in `sd29x9`, so `x.add(y)` and `sd29x9_base::add(x, y)` are equivalent. Types @@ -752,7 +808,8 @@ Types Functions - Arithmetic: [`add`](#sd29x9_base-add), [`sub`](#sd29x9_base-sub), [`mul`](#sd29x9_base-mul), [`mul_trunc`](#sd29x9_base-mul_trunc), [`mul_away`](#sd29x9_base-mul_away), [`div`](#sd29x9_base-div), [`div_trunc`](#sd29x9_base-div_trunc), [`div_away`](#sd29x9_base-div_away), [`mod`](#sd29x9_base-mod), [`rem`](#sd29x9_base-rem), [`pow`](#sd29x9_base-pow), [`sqrt`](#sd29x9_base-sqrt), [`ln`](#sd29x9_base-ln), [`log2`](#sd29x9_base-log2), [`log10`](#sd29x9_base-log10), [`negate`](#sd29x9_base-negate), [`abs`](#sd29x9_base-abs), [`ceil`](#sd29x9_base-ceil), [`floor`](#sd29x9_base-floor), [`unchecked_add`](#sd29x9_base-unchecked_add), [`unchecked_sub`](#sd29x9_base-unchecked_sub) -- Comparison: [`eq`](#sd29x9_base-eq), [`neq`](#sd29x9_base-neq), [`gt`](#sd29x9_base-gt), [`gte`](#sd29x9_base-gte), [`lt`](#sd29x9_base-lt), [`lte`](#sd29x9_base-lte), [`is_zero`](#sd29x9_base-is_zero) +- Standard-normal distributions: [`cdf`](#sd29x9_base-cdf), [`pdf`](#sd29x9_base-pdf), [`inverse_cdf`](#sd29x9_base-inverse_cdf) +- Comparison: [`eq`](#sd29x9_base-eq), [`neq`](#sd29x9_base-neq), [`gt`](#sd29x9_base-gt), [`gte`](#sd29x9_base-gte), [`lt`](#sd29x9_base-lt), [`lte`](#sd29x9_base-lte), [`is_zero`](#sd29x9_base-is_zero), [`is_negative`](#sd29x9_base-is_negative) - Cross-type casts: [`into_UD30x9`](#sd29x9_base-into_UD30x9), [`try_into_UD30x9`](#sd29x9_base-try_into_UD30x9) Errors @@ -762,6 +819,7 @@ Errors - [`ECannotBeConvertedToUD30x9`](#sd29x9_base-ECannotBeConvertedToUD30x9) - [`ENegativeSqrt`](#sd29x9_base-ENegativeSqrt) - [`ELogUndefined`](#sd29x9_base-ELogUndefined) +- [`EProbabilityOutOfRange`](#sd29x9_base-EProbabilityOutOfRange) #### Types [!toc] [#sd29x9_base-Types] @@ -962,6 +1020,42 @@ Rounds toward positive infinity to the nearest integer multiple of `10^9`. Aborts with `EOverflow` if the rounded result exceeds the representable `SD29x9` range. + +Returns the standard-normal cumulative probability `Φ(z)` as a non-negative `SD29x9`. `cdf(0)` is exactly `0.5`; inputs at or below `-6.109410205` return exactly `0`, and inputs at or above `6.109410205` return exactly `1`. + +Negative inputs are evaluated by reflection, so `z.cdf() + z.negate().cdf()` is exactly `1` except at `SD29x9::min()`, whose negation is unrepresentable. The result is monotone non-decreasing between adjacent representable inputs. Its maximum absolute approximation error is at most `5 * 10^-9` (5 ULP), with an empirical worst case of approximately `5 * 10^-10` for the committed fit. + +NOTE: The function is pure and deterministic. At 9-decimal resolution, adjacent inputs can return the same quantized probability. + + + +Returns the standard-normal probability density `φ(z)` as a non-negative `SD29x9`. The density is even, so equal magnitudes return equal results regardless of sign. `pdf(0)` is exactly `0.398942280`, and inputs with `|z| >= 6.402729806` return exactly `0`. + +The result is monotone non-increasing in `|z|`. Its maximum absolute approximation error is at most `5 * 10^-9` (5 ULP), with an empirical worst case of approximately `5 * 10^-10` for the committed fit. + +NOTE: The function is pure and deterministic. + + + +Returns the signed standard-normal quantile `Φ⁻¹(p)` for a probability in `[0, 1]`. `inverse_cdf(0.5)` is exactly `0`; the endpoints `0` and `1` return the finite clamps `-6.109410205` and `6.109410205` because the mathematical results are infinite. + +Aborts with `EProbabilityOutOfRange` if `p` is negative or greater than `1`. + +NOTE: The maximum absolute approximation error is at most `5 * 10^-9` (5 ULP). Across the deterministic validation grid, no result is more than 1 ULP from the correctly rounded output. Near `p = 0` or `p = 1`, a 1-ULP input change can produce a much larger quantile change because the mathematical function is intrinsically steep. + + + +Returns `true` if `x` is strictly less than zero, otherwise `false`. + + + +Raised when [`inverse_cdf`](#sd29x9_base-inverse_cdf) receives a negative probability or a probability greater than `1`. + + ### `sd29x9_convert` [toc] [#sd29x9_convert] ```move diff --git a/content/contracts-sui/1.x/fixed-point.mdx b/content/contracts-sui/1.x/fixed-point.mdx index b60b3eb7..87c78ffc 100644 --- a/content/contracts-sui/1.x/fixed-point.mdx +++ b/content/contracts-sui/1.x/fixed-point.mdx @@ -7,7 +7,7 @@ The example code snippets used in this guide are experimental and have not been The `openzeppelin_fp_math` package adds two decimal fixed-point types with 9 decimals of precision, matching Sui's native coin precision (`10^9`). It -is the right tool whenever you need real-valued arithmetic such as prices, fees, rates, ratios, and balance deltas, without giving up determinism or onchain auditability. +is the right tool whenever you need real-valued arithmetic such as prices, fees, rates, ratios, balance deltas, or standard-normal distribution functions, without giving up determinism or onchain auditability. The package complements `openzeppelin_math`, which covers integer arithmetic. Use `openzeppelin_math` when your values are whole numbers; reach for `openzeppelin_fp_math` when fractional values are part of the protocol. @@ -25,7 +25,7 @@ for `openzeppelin_fp_math` when fractional values are part of the protocol. The names encode the layout: `UD30x9` uses up to 30 integer digits with 9 fractional digits, `SD29x9` is the signed counterpart with one bit reserved for the sign. Both fit in 16 bytes of storage, so swapping `u128` for either type costs nothing in storage or arithmetic budget. -Pick **`UD30x9`** for any quantity that cannot be negative: token balances, prices, fees, exchange rates, supply totals. Pick **`SD29x9`** when the value can dip below zero: balance deltas, signed adjustments, P&L, position sides. +Pick **`UD30x9`** for any quantity that cannot be negative: token balances, prices, fees, exchange rates, supply totals, and non-negative Gaussian inputs or quantiles. Pick **`SD29x9`** when the value can dip below zero: balance deltas, signed adjustments, P&L, position sides, and full-range Gaussian inputs or quantiles. ## Usage @@ -100,6 +100,26 @@ public fun settle(amount: ud30x9::UD30x9): u64 { } ``` +### Evaluate the standard-normal distribution + +```move +module my_sui_app::gaussian; + +use openzeppelin_fp_math::sd29x9::{Self, SD29x9}; + +/// Return the cumulative probability and density at `z`. +public fun evaluate(z: SD29x9): (SD29x9, SD29x9) { + (z.cdf(), z.pdf()) +} + +/// Return the lower and upper bounds of a central 95% interval. +public fun central_95_bounds(): (SD29x9, SD29x9) { + let lower_p = sd29x9::wrap(25_000_000, false); // 0.025 + let upper_p = sd29x9::wrap(975_000_000, false); // 0.975 + (lower_p.inverse_cdf(), upper_p.inverse_cdf()) +} +``` + ## Choosing a function - `mul`, `div`: round toward zero. Equivalent to `mul_trunc`, `div_trunc`. Use as the default when rounding direction does not matter. @@ -107,6 +127,7 @@ public fun settle(amount: ud30x9::UD30x9): u64 { - `mul_away`, `div_away`: round away from zero when inexact. Use for fees, slippage caps, and protocol-side accounting where rounding should never favor the user against the protocol. - `unchecked_add`, `unchecked_sub`: wrap modulo `2^128` instead of aborting on overflow/underflow. Use only when you have already proved the operation is safe and you want to avoid the abort path. Otherwise prefer `add` / `sub`. - `pow`: approximate, biased toward zero, and not associative under truncation. Reasonable for small, integer exponents over typical fixed-point ranges. Verify expected behavior at your application's exponent and operand magnitudes before relying on it. +- `cdf`, `pdf`, `inverse_cdf`: evaluate the standard-normal cumulative distribution, density, and quantile. Use `SD29x9` for signed inputs and full-range quantiles; use `UD30x9` for non-negative inputs and upper-half quantiles. For `SD29x9` specifically, prefer `mod` (Euclidean, always non-negative) over `rem` (truncating, sign follows dividend) unless your protocol explicitly wants the truncating variant. @@ -240,7 +261,7 @@ Both directions truncate toward zero, so the vault never gives away fractional r ## Overflow and underflow -Unlike `openzeppelin_math`, the fixed-point package does **not** return `Option` from arithmetic. It aborts. The error constants come in three families: +Unlike `openzeppelin_math`, the fixed-point package does **not** return `Option` from arithmetic. It aborts. Arithmetic errors come in three families: - **`EOverflow`**: the result exceeds the representable range of the target type. - **`EUnderflow`**: applies to `UD30x9::sub` only. Subtraction would produce a negative value, which is unrepresentable in an unsigned type. @@ -277,7 +298,7 @@ public fun try_add(x: UD30x9, y: UD30x9): Option { ## Comparison and equality -Comparison operators on `UD30x9` and `SD29x9` work as you would expect (`eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `is_zero`). There is one subtle point on the signed type: +Comparison operators on `UD30x9` and `SD29x9` work as you would expect (`eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `is_zero`). The signed type also exposes `is_negative`. There is one subtle point on signed equality: ```move use openzeppelin_fp_math::sd29x9; @@ -362,6 +383,30 @@ For small integer exponents over operands that are not far from `1.0`, `pow` is - Switch to a pre-computed lookup or higher-precision representation in the worst-case region, or - Bound the rounding error analytically and check whether your protocol can absorb it. +## Standard-normal distribution functions + +Both fixed-point types expose three standard-normal functions as method-style calls: + +| Function | `UD30x9` | `SD29x9` | +|---|---|---| +| `cdf(z)` | Accepts `z >= 0`; returns `Φ(z)` in `[0.5, 1]`. | Accepts signed `z`; returns `Φ(z)` in `[0, 1]`. | +| `pdf(z)` | Accepts `z >= 0`; returns `φ(z)` in `[0, 0.398942280]`. | Accepts signed `z`; returns the non-negative density `φ(z)`. | +| `inverse_cdf(p)` | Accepts `p` in `[0.5, 1]`; returns a non-negative quantile. | Accepts `p` in `[0, 1]`; returns a signed quantile. | + +`cdf` and `pdf` accept every value representable by their input type. They saturate once the mathematical result rounds to an endpoint at 9-decimal resolution: + +- `cdf(z)` returns exactly `0` for `z <= -6.109410205` and exactly `1` for `z >= 6.109410205`. The unsigned variant only covers the non-negative half. +- `pdf(z)` returns exactly `0` for `|z| >= 6.402729806` and exactly `0.398942280` at `z = 0`. +- `inverse_cdf(0)` and `inverse_cdf(1)` return `-6.109410205` and `6.109410205` on `SD29x9`. These are finite clamps for mathematical infinities. The unsigned variant accepts only the upper half and returns `6.109410205` at `p = 1`. + +The maximum absolute approximation error is at most `5 * 10^-9` (5 ULP at the fixed-point scale). The committed CDF and PDF fits have an empirical worst case of approximately `5 * 10^-10`. The inverse-CDF validation grid found no result more than 1 ULP from the correctly rounded output. + +The quantized CDF is monotone non-decreasing between adjacent representable inputs. The PDF is monotone non-increasing in `|z|`. Equal neighboring outputs are expected where 9-decimal quantization cannot distinguish the mathematical values. All three functions are pure, deterministic, and object-free. + + +`inverse_cdf` validates its probability input. The `SD29x9` variant aborts with `EProbabilityOutOfRange` for negative values or values above `1`. The `UD30x9` variant also aborts with `EProbabilityBelowHalf` below `0.5`, because an unsigned type cannot represent the negative quantile. Near `p = 1`, a 1-ULP change in probability can produce a much larger change in the quantile; this is an intrinsic property of the distribution's tail. + + ## The `min()` gotcha on `SD29x9` `SD29x9::min()` returns `-2^127`. There is no representable `+2^127`, so several operations abort when called on `min()`: diff --git a/content/contracts-sui/1.x/index.mdx b/content/contracts-sui/1.x/index.mdx index 368b80bc..681ad14d 100644 --- a/content/contracts-sui/1.x/index.mdx +++ b/content/contracts-sui/1.x/index.mdx @@ -5,7 +5,7 @@ title: Contracts for Sui 1.x **OpenZeppelin Contracts for Sui v1.x** ships four core packages: - `openzeppelin_math` for deterministic integer arithmetic, configurable rounding, and decimal scaling. -- `openzeppelin_fp_math` for 9-decimal fixed-point arithmetic (`UD30x9`, `SD29x9`) backed by `u128`. +- `openzeppelin_fp_math` for 9-decimal fixed-point arithmetic and standard-normal distribution functions (`UD30x9`, `SD29x9`) backed by `u128`. - `openzeppelin_access` for role-based authorization and ownership-transfer wrappers around privileged `key + store` objects. - `openzeppelin_utils` for embeddable building blocks; its first module, `rate_limiter`, provides multi-strategy rate limiting. @@ -37,7 +37,7 @@ You only need the dependencies your app actually uses. Add what you need and dro ### 3. Verify `Move.toml` -`mvr add` updates `Move.toml` automatically. With all three installed it should include: +`mvr add` updates `Move.toml` automatically. With all four installed it should include: ```toml [dependencies] @@ -80,7 +80,7 @@ sui move test ## Picking a package - Need role-based authorization for privileged functions or controlled transfer of admin/treasury/upgrade capabilities? Use [Access](/contracts-sui/1.x/access). -- Need fractional values like prices, fees, rates, or signed deltas? Use [Fixed-Point Math](/contracts-sui/1.x/fixed-point). +- Need fractional values, standard-normal probabilities, densities, or quantiles? Use [Fixed-Point Math](/contracts-sui/1.x/fixed-point). - Need integer arithmetic with safe overflow and explicit rounding? Use [Integer Math](/contracts-sui/1.x/math). - Need to throttle withdrawals, meter per-user budgets, gate action reuse, or delay an action? Use [Rate Limiter](/contracts-sui/1.x/rate-limiter). diff --git a/content/contracts-sui/index.mdx b/content/contracts-sui/index.mdx index ba9f99a1..5f9df2e5 100644 --- a/content/contracts-sui/index.mdx +++ b/content/contracts-sui/index.mdx @@ -24,7 +24,7 @@ import { latestStable } from "./latest-versions.js"; Role-based authorization and ownership-transfer policies for privileged protocol operations. - 9-decimal fixed-point types (`UD30x9`, `SD29x9`) for prices, fees, rates, and signed balance deltas. + 9-decimal fixed-point types (`UD30x9`, `SD29x9`) for arithmetic and standard-normal distribution functions. Overflow-safe integer arithmetic with explicit rounding and decimal scaling helpers. @@ -41,7 +41,7 @@ import { latestStable } from "./latest-versions.js"; Explore the complete access API, including its functions, types, events, and errors. - Explore the complete fixed-point math API, including its types, functions, and errors. + Explore the complete fixed-point API, including arithmetic, conversions, and standard-normal distribution functions. Explore the complete integer math API, including its functions, types, and errors.