gibbsly / gm

A utility datapack for doing math operations
The Unlicense
33 stars 2 forks source link

Decimal zeros missing after division #2

Closed st-U00F6-pa closed 8 months ago

st-U00F6-pa commented 1 year ago

Description

When dividing one base-10 number by another base-10 number, if the result number has any zeros in the decimal part, they don't appear in the num array for some reason. For example, dividing number 2.202 (num:[2,2,0,2],dec:3,pol:1,base:10) by 2.0 (num:[2,0],dec:1,pol:1,base:10) results in a number 1.11 and not 1.101.

Screenshots

image 2.202 / 2.0 is 1.101, while the other digits are correct, zeros appear to be missing

image 3.141592 / 2.0 is 1.570796

How to reproduce

I know the work on the pack might be discontinued, but I'm really hoping for a fix, because otherwise the pack is a treasure :>

st-U00F6-pa commented 1 year ago

Also, surprisingly, this issue appears to be not present when the resulting number has two or more zeros in a row. That way, dividing 2.2002 by 2 results in a proper 1.1001, while 2.202 / 2 is still 1.11

gibbsly commented 1 year ago

interesting, I'll have to look into it, it might be trimming 0's a bit too much