Closed Bykiev closed 4 months ago
So what you are asking for is
the functionality of =ROUNDDOWN(31415.92654, -2)
Which rounds 31415.92654 down to 2 decimal places to the left of the decimal point, resulting in 31400
By allowing
BigDecimal Round(BigDecimal value, Int32 precision)
to accept negative values on the precision parameter?
Yes, you're right
This is done and should be working.
I have published an updated NuGet package with this feature and all of your bug fixes you have contributed: ExtendedNumerics.BigDecimal ver. 2025.1000.0.118
Thank you for your contributions and interest in my library.
For any bugs that are noticed, are there tests being written for them also?
For any bugs that are noticed, are there tests being written for them also?
Actually, I did check in tests for this new functionality, just in the commit prior to this one: https://github.com/AdamWhiteHat/BigDecimal/commit/f19fd65a0378ad537d5ff18477cf1478f732462c?diff=split&w=1#diff-8e5528d420d41e964bb8abcb89ae001e61e72506ac2f722a7058d969886e4778R217
@Bykiev Are you satisfied here? Can I close this request?
@AdamWhiteHat , hi, thank you for your inputs. It doesn't seems to be accurate
val = 88.123459; p = -3;
results to System.ArgumentOutOfRangeException, should be 0
val = 88.123459; p = -3;
results to System.ArgumentOutOfRangeException, should be 0 Try p = 2.
I wasn't anticipating people trying to pass in a negative precision greater than there are place values to move the decimal point. Well, I mean I did anticipate they might, I just choose to throw an exception in that case.
But I did just check the actual excel function, and it does seem to accept large negative value than there are digits without error:
So I guess I will change it to make it match Excel's behavior.
A new NuGet package, version 2025.1000.2.122 is now available.
Thank you, works great!
Proposal/Summary Add support for negative precision to behave like ROUNDDOWN Excel function
Rationale It will be useful to for rounding down to the left of the decimal point