mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Use Number for IOUAmount and STAmount arithmetic
* Guarded by amendment fixUniversalNumber * Produces slightly better accuracy in some computations.
This commit is contained in:
committed by
Elliot Lee
parent
48e804c40c
commit
a82ad5ba76
@@ -2122,7 +2122,7 @@ public:
|
||||
jrr = ledgerEntryState(env, bob, gw, "USD");
|
||||
BEAST_EXPECT(
|
||||
jrr[jss::node][sfBalance.fieldName][jss::value] ==
|
||||
"-0.966500000033334");
|
||||
"-0.9665000000333333");
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -905,6 +905,7 @@ public:
|
||||
{
|
||||
testcase("IOU to IOU");
|
||||
|
||||
NumberSO stNumberSO{true};
|
||||
Quality q1 = get_quality("1", "1");
|
||||
|
||||
// Highly exaggerated 50% transfer rate for the input and output:
|
||||
@@ -937,7 +938,7 @@ public:
|
||||
q1,
|
||||
{"4", "4"},
|
||||
"4",
|
||||
{"2.666666666666666", "2.666666666666666"},
|
||||
{"2.666666666666667", "2.666666666666667"},
|
||||
eur(),
|
||||
usd(),
|
||||
rate,
|
||||
@@ -993,7 +994,7 @@ public:
|
||||
q1,
|
||||
{"2", "2"},
|
||||
"10",
|
||||
{"1.666666666666666", "1.666666666666666"},
|
||||
{"1.666666666666667", "1.666666666666667"},
|
||||
eur(),
|
||||
usd(),
|
||||
rate,
|
||||
|
||||
@@ -411,13 +411,11 @@ class TrustAndBalance_test : public beast::unit_test::suite
|
||||
|
||||
if (with_rate)
|
||||
{
|
||||
// 65.00000000000001 is correct.
|
||||
// This is result of limited precision.
|
||||
env.require(balance(
|
||||
alice,
|
||||
STAmount(
|
||||
carol["USD"].issue(),
|
||||
6500000000000001ull,
|
||||
6500000000000000ull,
|
||||
-14,
|
||||
false,
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user