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

@ -1,7 +1,7 @@
/// @file grotto/hexfloat.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief Hexadecimal floating-point formatting for IEEE doubles and wide fixed-point words.
/// @details
/// @details Prints IEEE doubles and wide fixed-point words in hexadecimal.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -225,9 +225,14 @@ inline int highest_bit(const std::uint64_t * limbs) noexcept
return -1;
}
/// Exact hexfloat of a two's-complement word whose binary point sits `fractional_bits`
/// @brief Exact hexfloat of a two's-complement word whose binary point sits `fractional_bits`
/// below bit 0. The fraction keeps every bit below the leading 1, so a 256-bit word
/// round-trips.
/// @tparam T value type
/// @param value the value to convert or store
/// @param fractional_bits the number of fractional bits
/// @return Exact hexfloat of a two's-complement word whose binary point sits `fractional_bits`
/// below bit 0
template <typename T>
std::string format_hexfloat(const T & value, int fractional_bits)
{
@ -330,9 +335,14 @@ inline void shift_right_limbs(std::vector<std::uint64_t> & limbs, unsigned shift
limbs.swap(out);
}
/// Parse `±0x<hex>.<hex>p±<dec>` into the low `width` bits of
/// @brief Parse `±0x<hex>.<hex>p±<dec>` into the low `width` bits of
/// significand * 2^(exponent + fractional_bits), floored toward -inf on the
/// discarded fraction and wrapped modulo 2^width.
/// @tparam T value type
/// @param text the `text`
/// @param fractional_bits the number of fractional bits
/// @return the returned `T`
/// @throws std::invalid_argument if `empty hexfloat`
template <typename T>
T integer_from_hexfloat(std::string_view text, int fractional_bits)
{