Closed alex-hrb-0 closed 2 months ago
Hi there,
I'm using bankers rounding and I'm getting 0.64535 perfectly rounded to 0.6454 in the following example:
bankers
0.64535
0.6454
dec::decimal<1, dec::half_even_round_policy> s1(550), s2(550); dec::decimal<4, dec::half_even_round_policy> p1(350.68), p2(359.2050); std::cout << (p1 + p2) / (s1 + s2);
But I probably don't need precision for s1 and s2 so I changed the precision from 1 to 0 for them:
s1
s2
1
0
dec::decimal<0, dec::half_even_round_policy> s1(550), s2(550); dec::decimal<4, dec::half_even_round_policy> p1(350.68), p2(359.2050); std::cout << (p1 + p2) / (s1 + s1);
And I started getting 0.6453 instead of 0.6454 which seems wrong for the selected rounding method.
0.6453
It's an edge case, corrected, thanks for reporting.
Hi there,
I'm using
bankers
rounding and I'm getting0.64535
perfectly rounded to0.6454
in the following example:But I probably don't need precision for
s1
ands2
so I changed the precision from1
to0
for them:And I started getting
0.6453
instead of0.6454
which seems wrong for the selected rounding method.