Commit Graph

10112 Commits

Author SHA1 Message Date
Ed Hennis
685367248c Merge branch 'ximinez/number-round-maxrep-down' into ximinez/number-round-maxrep 2026-06-15 12:12:15 -04:00
Ed Hennis
bebddb0e3e Merge branch 'develop' into ximinez/number-round-maxrep-down 2026-06-15 12:12:10 -04:00
Bart
f5985e73ec fix: Always charge peer on strand (#7422)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-06-15 14:55:56 +00:00
Ed Hennis
22a7f5bb49 Fix assertion typo src/libxrpl/basics/Number.cpp
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-06-12 19:44:08 -04:00
Ed Hennis
a63bab2a5e Cleanups: Comments, variable names, one test case
- "ToNearest and Downward behavior Small" test case
2026-06-12 19:38:07 -04:00
Ed Hennis
095e14193e Apply suggestions from AI code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-12 19:29:01 -04:00
Ed Hennis
305977058b Merge remote-tracking branch 'XRPLF/ximinez/number-round-maxrep-down' into ximinez/number-round-maxrep
* XRPLF/ximinez/number-round-maxrep-down:
  Apply suggestions from AI code review
2026-06-12 19:08:04 -04:00
Ed Hennis
b30a70bbf8 Apply suggestions from AI code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-12 18:44:00 -04:00
Ed Hennis
1ef0c5ab44 Merge branch 'ximinez/number-round-maxrep-down' into ximinez/number-round-maxrep 2026-06-11 23:02:58 -04:00
Ed Hennis
463fb88cd8 Apply suggestions from AI code review
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-06-11 23:02:47 -04:00
Ed Hennis
353b3ae07d fixup! AI: Remove extranenous enum copy 2026-06-11 23:00:08 -04:00
Ed Hennis
b2790e2f50 AI: Remove extranenous enum copy
Co-authored-by: xrplf-ai-reviewer[bot] <266832837+xrplf-ai-reviewer[bot]@users.noreply.github.com>
2026-06-11 22:57:31 -04:00
Ed Hennis
f8f899dd8a Merge remote-tracking branch 'XRPLF/ximinez/number-round-maxrep-down' into ximinez/number-round-maxrep
* XRPLF/ximinez/number-round-maxrep-down:
  Change placeholder "fixNumberStuff" to "fixCleanup3_3_0"
  test: Add null check unit test for `Oracle::aggregatePrice` (7306)
  ci: Patch conan recipe for Nix to be able to use on macOS (7532)
  ci: Run sanitizers on release builds too (7527)
  fix: Correct hybrid offer deletion on credential expiry (6843)
  ci: Make sanitizer flags lists in the profile, not a string (7449)
  ci: Make configurations launch on certain event types (7447)
  fix: Add [[maybe_unused]] to fix320Enabled for assert=OFF builds (7446)
  ci: Add `gh` and `file` to nix packages (7444)
  fix: Disable transaction invariants (7409)
  perf: Dispatch "hasInvalidAmount()" on type tag instead of dynamic_cast (7402)
  refactor: Retire fixUniversalNumber amendment (5962)
  test: Do not create data directory for memory databases (7323)
  ci: Launch upload-conan-deps on profile change (7442)
2026-06-11 22:55:31 -04:00
Ed Hennis
308e00f590 Merge commit 'b087545' into ximinez/number-round-maxrep
* commit 'b087545':
  Number improvements
  test: Add more Number edge case tests, showing failures
2026-06-11 22:48:22 -04:00
Ed Hennis
29d017c2a3 Change placeholder "fixNumberStuff" to "fixCleanup3_3_0" 2026-06-11 22:02:50 -04:00
Ed Hennis
764be7f20f Merge remote-tracking branch 'XRPLF/develop' into ximinez/number-round-maxrep-down
* XRPLF/develop:
  test: Add null check unit test for `Oracle::aggregatePrice` (7306)
  ci: Patch conan recipe for Nix to be able to use on macOS (7532)
  ci: Run sanitizers on release builds too (7527)
  fix: Correct hybrid offer deletion on credential expiry (6843)
  ci: Make sanitizer flags lists in the profile, not a string (7449)
  ci: Make configurations launch on certain event types (7447)
  fix: Add [[maybe_unused]] to fix320Enabled for assert=OFF builds (7446)
  ci: Add `gh` and `file` to nix packages (7444)
  fix: Disable transaction invariants (7409)
  perf: Dispatch "hasInvalidAmount()" on type tag instead of dynamic_cast (7402)
  refactor: Retire fixUniversalNumber amendment (5962)
  test: Do not create data directory for memory databases (7323)
  ci: Launch upload-conan-deps on profile change (7442)
2026-06-11 19:39:47 -04:00
Ed Hennis
5703ca527f Number improvements
- Expand documentation.
- Refactor Number::Guard::round() to simplify.
- Set the Guard sign correctly in += for numbers with the same exponent.
  - Only really relevant if both values are negative.
- In +=, when needed, expand one mantissa to a size large enough to have
  a few extra digits, which can be used to determine rounding.
  - If the exponents are still different, trim the other mantissa as
    before until the exponents match.
  - For subtraction (where the values' signs are different), pop digits
    out of the Guard as necessary, but go far enough to have a few extra
    digits again for rounding later.
  - Finally, don't discard any "leftover" digits in the Guard when
    normalizing, to avoid the 0.5....nnn problem.
2026-06-11 19:38:21 -04:00
Ed Hennis
a1cfa89e15 test: Add more Number edge case tests, showing failures
- NumberAddDirectedSignWrong
  - Addition of two negative numbers with the same exponent rounds
    ToNearest in the wrong direction.
  - Also include unit test cases with same exponent, and mixed signs.
    - No rounding issues in any combination, because the exponent can't
      change.
- NumberAddToNearestPicksFarther
  - In scenarios where the two operands have different signs, and
    significantly different exponents, you can end up in a situation
    where the rounding looks like 0.5, which may round down to even, but
    is actually 0.5....nnn, which should always round up, you get the
    wrong result.
2026-06-11 19:38:21 -04:00
Ed Hennis
318c2c2dd3 Also fix local 3_2_0 variable names 2026-06-11 19:38:21 -04:00
Ed Hennis
5c62c15ad8 Future proofing: Rename Large and Enabled to Large330 and Enabled330
- If more fixes need to be made in the future, they can be added after,
  instead of needing to do the "rename dance", I had to do with this PR.
2026-06-11 19:38:20 -04:00
Ed Hennis
772e0c30f7 clang-tidy: rename MantissaScale enums from "3_2_0" to "320" 2026-06-11 19:38:20 -04:00
Ed Hennis
182ca1c12f Clean up the "New" names 2026-06-11 19:38:20 -04:00
Ed Hennis
2e97056b40 Update to use a new amendment, since this PR will not be part of 3.2.0
- This requires creating yet another MantissaScale, and CuspRoundingFix
  option.
2026-06-11 19:38:03 -04:00
Ed Hennis
693e9015ab clang-tidy: Guard public member variable names; Missing include 2026-06-11 19:38:01 -04:00
Ed Hennis
1162ccf7f4 Clean up tests 2026-06-11 19:37:57 -04:00
Ed Hennis
07ae5fa867 Reorganize the subtraction tests 2026-06-11 19:37:56 -04:00
Ed Hennis
6cc45297d7 Fix formatting, add an assert 2026-06-11 19:37:56 -04:00
Ed Hennis
b263f442be Revert "Rollback Number class changes; show the fix works without side effects"
This reverts commit 8743be8eae.
2026-06-11 19:37:56 -04:00
Ed Hennis
7191574499 Rollback Number class changes; show the fix works without side effects 2026-06-11 19:37:56 -04:00
Ed Hennis
e77b154edc Include rounding in failed unit tests 2026-06-11 19:37:56 -04:00
Ed Hennis
184f936362 Improve comment descriptions 2026-06-11 19:37:55 -04:00
Ed Hennis
64cb53629d Rework subtraction rounding (again) for more accuracy
- Go back to the old method of computing the mantissa, but when post
  processing, expand the mantissa to slightly larger than maxMantissa,
  then in doRoundDown, if the result is not exact, subtract one.
  Finally, let doNormalize figure out the rounding of the result.
2026-06-11 19:37:55 -04:00
Ed Hennis
8ca90e7d01 refactor: Construct Number::Guard from MantissaRange or relevant fields
- Simplifies the function signatures in Guard, because it doesn't need
  to have those values passed in constantly.
- Also simplifies some of the functions because they don't need to store
  values just to pass them to Guard functions.
2026-06-11 19:37:55 -04:00
Ed Hennis
0a24023797 clang-tidy: template param names, const correctness, braces 2026-06-11 19:37:55 -04:00
Ed Hennis
73bd964917 Remove the kMaxRep+1 rounding tests 2026-06-11 19:37:54 -04:00
Ed Hennis
48e0ca72b0 Improve accuracy of Number::operator+=
- Use more of the available range of the uint128 operands.
- Also refactor Number::Guard::round() to return an enum.
2026-06-11 19:37:54 -04:00
Ed Hennis
6d89fbef7a Experimental: Scale addition operands up to preserve accuracy 2026-06-11 19:37:54 -04:00
Ed Hennis
b624b2eeae Include upward, write tests based on "expected" behavior 2026-06-11 19:37:54 -04:00
Ed Hennis
f255ef6214 test: Add another rounding unit test 2026-06-11 19:37:53 -04:00
Ed Hennis
b087545755 Number improvements
- Expand documentation.
- Refactor Number::Guard::round() to simplify.
- Set the Guard sign correctly in += for numbers with the same exponent.
  - Only really relevant if both values are negative.
- In +=, when needed, expand one mantissa to a size large enough to have
  a few extra digits, which can be used to determine rounding.
  - If the exponents are still different, trim the other mantissa as
    before until the exponents match.
  - For subtraction (where the values' signs are different), pop digits
    out of the Guard as necessary, but go far enough to have a few extra
    digits again for rounding later.
  - Finally, don't discard any "leftover" digits in the Guard when
    normalizing, to avoid the 0.5....nnn problem.
2026-06-11 18:59:59 -04:00
Ed Hennis
1bb1d71565 test: Add more Number edge case tests, showing failures
- NumberAddDirectedSignWrong
  - Addition of two negative numbers with the same exponent rounds
    ToNearest in the wrong direction.
  - Also include unit test cases with same exponent, and mixed signs.
    - No rounding issues in any combination, because the exponent can't
      change.
- NumberAddToNearestPicksFarther
  - In scenarios where the two operands have different signs, and
    significantly different exponents, you can end up in a situation
    where the rounding looks like 0.5, which may round down to even, but
    is actually 0.5....nnn, which should always round up, you get the
    wrong result.
2026-06-11 18:27:25 -04:00
Pratik Mankawde
df395d6851 test: Add null check unit test for Oracle::aggregatePrice (#7306)
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
2026-06-11 18:05:36 +00:00
Zhiyuan Wang
09c36d066e fix: Correct hybrid offer deletion on credential expiry (#6843)
Co-authored-by: Bart <bthomee@users.noreply.github.com>
2026-06-10 20:42:41 +00:00
Ed Hennis
d8e03a8018 Update more names due to prior merge 2026-06-10 13:26:34 -04:00
Shi Cheng
1f359f719c fix: Add [[maybe_unused]] to fix320Enabled for assert=OFF builds (#7446)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-10 17:24:44 +00:00
Vito Tumas
83cc5df72e fix: Disable transaction invariants (#7409) 2026-06-10 12:05:53 +00:00
Vito Tumas
97ca7d57bc perf: Dispatch "hasInvalidAmount()" on type tag instead of dynamic_cast (#7402) 2026-06-10 11:44:57 +00:00
Pratik Mankawde
8a4bf2dee6 refactor: Retire fixUniversalNumber amendment (#5962)
Signed-off-by: Pratik Mankawde <pmankawde@ripple.com>
Signed-off-by: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-10 10:16:03 +00:00
Bart
742aa0878b test: Do not create data directory for memory databases (#7323)
Co-authored-by: Bart <11445373+bthomee@users.noreply.github.com>
2026-06-10 09:16:53 +00:00
Ed Hennis
e4dafa3171 Update names due to prior merge 2026-06-09 19:14:40 -04:00