Describe the bug
Due to floating point precision in JavaScript being less-than-ideal, there are a number of cases where converting to the exalt value and from the exalt value back to chaos is causing inconsistencies.
When parsing craft values from exalt to chaos, then back to exalt, it's possible to add or lose a chaos because of lost "precision". For example, 0.059ex is 10.679c and 0.05ex is 9.05c and the expected chaos value from TFT is 10c. Deciding how to get there is tricky without a significant sample of test data and given the prices are fluctuating finding good sample data is tricky.
When totaling the value of a crafting inventory, multiplying the quantity (n) of a craft by its exalt price results in a n degree of separation from the actual value. Take the same example from above: multiplying 0.059 for the price of a resist change craft by a quantity of 3 results in 0.177ex, or 33c (ceiling) when the actual sum should be 30c as each craft should be 10c. However, if you use the standard tricks to get the precision by doing (parseInt(0.059 * 100) * quantity) / 100 * price you end up with 27c.
To Reproduce
Steps to reproduce the behavior:
All current values showcase this issue.
Expected behavior
Prices should be always accurate to their total chaos value.
Screenshots
N/A
Additional context
Moving to chaos prices for everything and using division and modulus to determine exalt values and remainders leaves us in a position where no floats are required.
Describe the bug Due to floating point precision in JavaScript being less-than-ideal, there are a number of cases where converting to the exalt value and from the exalt value back to chaos is causing inconsistencies.
0.059ex
is10.679c
and0.05ex
is9.05c
and the expected chaos value from TFT is10c
. Deciding how to get there is tricky without a significant sample of test data and given the prices are fluctuating finding good sample data is tricky.n
) of a craft by its exalt price results in an
degree of separation from the actual value. Take the same example from above: multiplying0.059
for the price of a resist change craft by a quantity of 3 results in0.177ex
, or33c
(ceiling) when the actual sum should be30c
as each craft should be10c
. However, if you use the standard tricks to get the precision by doing(parseInt(0.059 * 100) * quantity) / 100 * price
you end up with27c
.To Reproduce Steps to reproduce the behavior:
Expected behavior Prices should be always accurate to their total chaos value.
Screenshots N/A
Additional context Moving to chaos prices for everything and using division and modulus to determine exalt values and remainders leaves us in a position where no floats are required.