OrderedSet86 / gtnh-flow

Factory Optimization Flowcharts for Gregtech: New Horizons
MIT License
84 stars 24 forks source link

Tries to fix node quantities rounding problem #36

Closed joegnis closed 6 months ago

joegnis commented 6 months ago

Fixes #35

This fix does not try to round only for powerline nodes, because other nodes can have fractions, such as recipes with chanced outputs. It applies rounding to all fractional node quantities.

joegnis commented 6 months ago

Forgot to mention that this PR also removes the +1 length threshold for fractions because it used to format number 1024 to 1.024k for example, which I found out is unnecessary.

As a side note, when implementing this fix, initially I tried to multiple small fraction like 0.0001 with power of 10, but I found that this can lead to issue with floating point precision problem. For example, 0.00013 would become 0.0001300000002 at the end. I switched to logarithm and this issue is gone. I am not sure why. Hope this won't appear in the future. Otherwise I think I will have to resort to decimal.

OrderedSet86 commented 6 months ago

Looks great, thanks!