Document the new DPF surfaces in one command set, and test the field, half-tree, and multipoint edges.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ryan Henry 2026-09-24 23:18:10 -06:00
parent 0d8a5a8131
commit 0dff6df8ed
250 changed files with 12199 additions and 1981 deletions

View file

@ -151,8 +151,11 @@ inline unsigned __int128 isqrt_floor(unsigned __int128 n)
return x;
}
/// `round(sqrt(v / 2^{k+1}) * 2^{k+extra})`, `v > 0`. Eight extra bits so the
/// @brief `round(sqrt(v / 2^{k+1}) * 2^{k+extra})`, `v > 0`. Eight extra bits so the
/// half-angle identity can absorb the square root before the final rounding.
/// @param fractional_bits the number of fractional bits
/// @param magnitude the magnitude
/// @return `round(sqrt(v / 2^{k+1}) * 2^{k+extra})`, `v > 0`
inline std::int64_t sqrt_half_scale_fine(unsigned fractional_bits, std::int64_t magnitude)
{
constexpr unsigned extra = 8;
@ -210,7 +213,7 @@ inline std::int64_t eval_asin_abs(unsigned fractional_bits, std::int64_t magnitu
return out < 0 ? 0 : out;
}
/// Surplus fractional bits on probit-tail knots. `u = ln(p)` is stored as
/// @brief Surplus fractional bits on probit-tail knots. `u = ln(p)` is stored as
/// `round(u * 2^{k+probit_tail_extra})`.
inline constexpr unsigned probit_tail_extra = 10;
@ -227,7 +230,10 @@ static constexpr std::uint64_t probit_ln_anchor_mag[32] = {
1190525582320469641ull, 885613779509420443ull, 585660112482476600ull, 290505910572683730ull,
};
/// `round_half_away(ln(probability / 2^k) * 2^{k+10})`.
/// @brief `round_half_away(ln(probability / 2^k) * 2^{k+10})`.
/// @param fractional_bits the number of fractional bits
/// @param probability the `probability`
/// @return `round_half_away(ln(probability / 2^k) * 2^{k+10})`
inline std::int64_t probit_ln_argument(unsigned fractional_bits, std::int64_t probability)
{
const auto bits = static_cast<unsigned long long>(probability);
@ -253,7 +259,14 @@ inline std::int64_t probit_ln_argument(unsigned fractional_bits, std::int64_t pr
return round_half_away_i128(ln_x, 54u - fractional_bits);
}
/// Horner, then one extra right shift so a tail argument at scale `k+10` rounds onto scale `k`.
/// @brief Horner, then one extra right shift so a tail argument at scale `k+10` rounds onto scale `k`.
/// @param piece the `piece`
/// @param q the `q`
/// @param raw the underlying integer
/// @param fractional_bits the number of fractional bits
/// @param extra_shift the `extra_shift`
/// @return Horner, then one extra right shift so a tail argument at scale `k+10` rounds onto scale
/// `k`
inline std::int64_t eval_cubic_extra(
const cubic_bits & piece, unsigned q, std::int64_t raw,
unsigned fractional_bits, unsigned extra_shift)