From 2ccf132f7941b8977d2af2ec21a72d6a3d5b1a89 Mon Sep 17 00:00:00 2001 From: Ed Hennis Date: Thu, 19 Feb 2026 19:02:03 -0500 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- include/xrpl/basics/Number.h | 8 +++++--- src/libxrpl/basics/Number.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/xrpl/basics/Number.h b/include/xrpl/basics/Number.h index 49a7d43975..ead21f0fd2 100644 --- a/include/xrpl/basics/Number.h +++ b/include/xrpl/basics/Number.h @@ -22,9 +22,11 @@ to_string(Number const& amount); /** Returns a rough estimate of log10(value). * - * The return value is a pair (log, rem), where log is the estimated log10, - * and rem is value divided by 10^log. If rem is 1, then value is an exact - * power of ten, and log is the exact log10(value). + * The return value is a pair (log, rem), where log is the estimated + * base-10 logarithm (roughly floor(log10(value))), and rem is value with + * all factors of 10 removed (i.e., divided by the largest power of 10 that + * divides value). If rem is 1, then value is an exact power of ten, and + * log is the exact log10(value). * * This function only works for positive values. */ diff --git a/src/libxrpl/basics/Number.cpp b/src/libxrpl/basics/Number.cpp index fa2d006a9e..c59b9b1f1a 100644 --- a/src/libxrpl/basics/Number.cpp +++ b/src/libxrpl/basics/Number.cpp @@ -282,7 +282,7 @@ Number::Guard::doRound(rep& drops, std::string_view location) static_assert(sizeof(internalrep) == sizeof(rep)); // This should be impossible, because it's impossible to represent // "largestMantissa + 0.6" in Number, regardless of the scale. There aren't - // enough digits available. You'd either get a mantissa of "largestMantissa " + // enough digits available. You'd either get a mantissa of "largestMantissa" // or "largestMantissa / 10 + 1", neither of which will round up when // converting to rep, though the latter might overflow _before_ // rounding.