Log In
Ice Weather Castform Don't have an account yet? Register now!
.

Forum Thread

percentage bbcode bug at 58%

Forum-Index Bug Reports Resolved percentage bbcode bug at 58%
loketoke
ONLINE
Trainerlevel: 153

Forum Posts: 605
Posted: Tue, 03/11/2020 09:51 (4 Years ago)
I've noticed that the new percentage bbcode is doing a weird thing when it reachs the 58%. I've got 58 items but the percentage says I'm at 57%

I've tested with lower amount of items and it appears correctly (56 items with a progress of 56%) and also with bigger amounts (59 items with a progress of 59%)
I also tested if it was just one item what was giving the issue but it happens with other items too.

The bbcode used was this:
[pkmn]488[/pkmn] [b]CRESSELIA PROGRESS ([bag=yellow lunar wing,goal=100]%)[/b] [pkmn]488[/pkmn]
[bag=yellow lunar wing] X [item]yellow-lunar-wing[/item] collected so far


And here is a picture of the result
Riako
OFFLINE
Trainerlevel: 70

Forum Posts: 2,759
Posted: Mon, 09/11/2020 13:44 (4 Years ago)
This is not a bug that can really be fixed as it's a "bug" caused by how computers work. Due to the limited amount of bits used to represent a number, numbers may lose precision when performing divisions. In the case of the bag percentages, the number of items you currently own is divided by your goal (in this case: 58 / 100).

You can try it out yourself:
JSFiddle. All this does is calculate (58 / 100) * 100 and yet it outputs (at least on my computer): 57.999999
loketoke
ONLINE
Trainerlevel: 153

Forum Posts: 605
Posted: Mon, 09/11/2020 15:16 (4 Years ago)