Core Loot Manager DKP & EPGP & SK

Core Loot Manager DKP & EPGP & SK

2M Downloads

Decimal DKP values after Decay

crimsoncoyote opened this issue ยท 10 comments

commented

Describe the bug
After applying percentage decay, DKP can be a decimal value.

To Reproduce
Steps to reproduce the behavior:

  1. Apply DKP decay to DKP value which doesn't divide evenly

Expected behavior
DKP should be able to be rounded to a whole number. Barring that, a workaround would be needed to grant/remove partial DKP points manually.

AddOn and Game Version:
CLM 0.7.0

commented

There is always rounding in floats, the question is whether we actively manage it..

commented

I'm against any form of rounding values internally @SamMousa . I would propose a configurable display rounding solution (which will not alter the value internally itself).
Proposed formats:
1 (no decimals)
0.1 (tens)
0.01 (hundreds)

commented

I would say a reasonable approach is to only round on display to the nearest hundredth, but keep the precision there for the data.

commented

We have already decided that we always round to a fixed number of decimals. At most 5, configurable by the user.
We will round not just for display; reasoning is that rounding for display causes weird behavior.
If you see 8 DKP balance and you decay 50% you always want to see 4, not 3 because it might have been 7.5 rounded down.
(Note that the example doesn't necessarily work if we round to nearest int, but always an example can be found where the loss of information leads to unpredictable result , from the perspective of an observer seeing just the rounded number.

commented

Thanks for the contribution!

commented

Fixed by #93

commented

The part that pushes it into "bug" territory for me is that I don't think you can do anything about it in the interface right now? But perhaps I am wrong there. Ok, it looks like partial point can be awarded, but a leading 0 is required. It's not obvious and if you can't read the regex it's impenetrable.

Actually, looking at it, the constants for the regexes appear to be wrong:

CONSTANTS.REGEXP_FLOAT = "^-?%d+.?%d*$"
CONSTANTS.REGEXP_FLOAT_POSITIVE = "^%d+.?%d*$"

The two . in these patterns need to be escaped:

CONSTANTS.REGEXP_FLOAT = "^-?%d+%.?%d*$"
CONSTANTS.REGEXP_FLOAT_POSITIVE = "^%d+%.?%d*$"

Otherwise values like "10t3" or "5#" would match and don't throw an error.

commented

Also, we should always be rounding to a fixed number of decimals, otherwise we get into float trouble territory. Even if we want decimals we should limit it to something <= 4

commented

I feel like this should be more of a optional setting where it rounds to the nearest whole. Coming from CommunityDKP and before that MonolithDKP, there was always fractions of a whole number.

commented

After three weeks we are now at 8 Numbers behind the dot :-) rounding to 1 or 2 behind would bei nice