John Freeman
36b34a7bd5
Update dependency: grpc ( #4407 )
2023-02-07 15:46:38 -08:00
Howard Hinnant
5edaec2bd0
Introduce min/max observers for Number
...
Three static member functions are introduced with
definitions consistent with std::numeric_limits:
static constexpr Number min() noexcept;
Returns: The minimum positive value. This is the value closest to zero.
static constexpr Number max() noexcept;
Returns: The maximum possible value.
static constexpr Number lowest() noexcept;
Returns: The negative value which is less than all other values.
2023-02-07 15:43:28 -08:00
Howard Hinnant
2f1f453052
Optimize uint128_t division by 10 within Number.cpp
...
* Optimization includes computing remainder from division.
* Used only within Number::operator*=.
2023-02-07 15:43:28 -08:00
Howard Hinnant
6eaaa7bcfa
Replace Number division algorithm
...
* Replace division with faster algorithm.
* Correct some rounding bugs in multiplication.
* Add tests for rounding bugs.
2023-02-07 15:43:28 -08:00
Howard Hinnant
e354497f63
Include rounding mode in XRPAmount to STAmount conversion.
2023-02-07 15:43:28 -08:00
Howard Hinnant
6fcd654bee
Remove undefined behavior
...
* Taking the negative of a signed negative is UB, but
taking the negative of an unsigned is not.
2023-02-07 15:43:28 -08:00
Howard Hinnant
d275a2ab72
Silence warnings
2023-02-07 15:43:28 -08:00
Howard Hinnant
3f33471220
Introduce rounding modes for Number:
...
You can set a thread-local flag to direct Number how to round
non-exact results with the syntax:
Number::rounding_mode prev_mode = Number::setround(Number::towards_zero);
This flag will stay in effect for this thread only until another call
to setround. The previously set rounding mode is returned.
You can also retrieve the current rounding mode with:
Number::rounding_mode current_mode = Number::getround();
The available rounding modes are:
* to_nearest : Rounds to nearest representable value. On tie, rounds
to even.
* towards_zero : Rounds towards zero.
* downward : Rounds towards negative infinity.
* upward : Rounds towards positive infinity.
The default rounding mode is to_nearest.
2023-02-07 15:43:28 -08:00
Howard Hinnant
a82ad5ba76
Use Number for IOUAmount and STAmount arithmetic
...
* Guarded by amendment fixUniversalNumber
* Produces slightly better accuracy in some computations.
2023-02-07 15:43:28 -08:00
Howard Hinnant
48e804c40c
Add tests
2023-02-07 15:43:28 -08:00
Howard Hinnant
c9c54c9799
Add implicit conversion from STAmount to Number
2023-02-07 15:43:28 -08:00
Howard Hinnant
24fe5f9fd0
Add clip
...
* Return 0 if abs(x) < limit, else returns x
2023-02-07 15:43:28 -08:00
Howard Hinnant
476ee8a479
Add conversions between Number, XRPAmount and int64_t
...
* Conversions to Number are implicit
* Conversions away from Number are explicit and potentially lossy
* If lossy, round to nearest, and to even on tie
2023-02-07 15:43:28 -08:00
Howard Hinnant
0ee63b7c7b
AMM Add Number class and associated algorithms
2023-02-07 15:43:28 -08:00
Richard Holland
2916b7e692
fix buildinfo test
2023-02-07 18:13:31 +00:00
Richard Holland
d72a597aa4
fix for https://github.com/Xahau/xahaud/issues/7
2023-02-07 16:55:38 +00:00
Richard Holland
5da990661a
version string generation
2023-02-07 16:15:57 +00:00
Richard Holland
d3cc1a8798
fix validator list unit tests
2023-02-07 12:10:41 +00:00
Richard Holland
aa61e1be38
fix for https://github.com/Xahau/xahaud/issues/6
2023-02-07 09:40:47 +00:00
Richard Holland
307f9702ea
fix for https://github.com/Xahau/xahaud/issues/5
2023-02-07 09:18:46 +00:00
Richard Holland
192308fb3e
fix for https://github.com/Xahau/xahaud/issues/4
2023-02-07 08:52:39 +00:00
Richard Holland
0e2e674c51
clean up invariant check for IOUescrow + remove (now) unwanted testcase
2023-02-07 08:43:23 +00:00
Richard Holland
0f10f3b5c0
second fix for https://github.com/Xahau/xahaud/issues/3
2023-02-06 12:41:30 +00:00
Richard Holland
86614de00e
fix admin rpc test for networkid
2023-02-06 12:16:26 +00:00
Richard Holland
b9903a822f
remove networkid from test env
2023-02-06 11:11:46 +00:00
Richard Holland
584db523b4
merge fail
2023-02-06 10:50:43 +00:00
Richard Holland
14dee2d976
Merge branch 'icv2-super' into dev
2023-02-06 10:35:57 +00:00
Richard Holland
cfb8e02f16
bug fix
2023-02-06 09:17:33 +00:00
Denis Angell
43b6e89303
nit: change flag guard
2023-02-06 09:17:13 +00:00
Denis Angell
0aa2c26680
clang-format
2023-02-06 09:16:10 +00:00
Denis Angell
c848fe91d6
tests
2023-02-06 09:15:53 +00:00
Denis Angell
56d062f907
fix lint bug
2023-02-06 09:13:57 +00:00
Denis Angell
7d4b00cfcb
remove comments
2023-02-06 09:12:56 +00:00
Denis Angell
66105b6c68
debug & testing
2023-02-06 09:12:38 +00:00
Denis Angell
641b8c546d
[FOLD] remove comment
2023-02-06 09:12:27 +00:00
Denis Angell
8186dd960e
[FOLD] invalid tests
2023-02-06 09:12:06 +00:00
Denis Angell
11bfcbf915
fix generic
2023-02-06 09:11:43 +00:00
Denis Angell
8df65be522
fix uri token flags
2023-02-06 09:09:20 +00:00
Denis Angell
9effcc3924
add testfile and cmake
2023-02-06 09:05:26 +00:00
Denis Angell
163c2b4631
clang-format
2023-02-06 09:03:11 +00:00
Denis Angell
be7ca74e46
finish tests
2023-02-06 09:01:39 +00:00
Denis Angell
448258f861
fix final dest amount
2023-02-06 09:00:34 +00:00
Denis Angell
f8591d0fd6
fix finalAmount + guard dest Issuer
2023-02-06 09:00:03 +00:00
Denis Angell
31da4bf8d4
bad currency guard
2023-02-06 08:59:47 +00:00
Denis Angell
4e6e81f5de
clang-format
2023-02-06 08:59:33 +00:00
Denis Angell
b5e9325bd9
clang-format
2023-02-06 08:59:21 +00:00
Denis Angell
c7aec60cec
precision paychan test
2023-02-06 08:59:08 +00:00
Denis Angell
5d6726ce07
update insuficient funds error
2023-02-06 08:58:35 +00:00
Denis Angell
ac72ef80a4
nit
2023-02-06 08:58:18 +00:00
Denis Angell
c681de1d39
nit
2023-02-06 08:58:04 +00:00