MeltValue.com Rounding Algorithm
We use a rounding algorithm which is designed to output user-friendly numbers by rounding to a reasonable precision.
We begin with the notion that when a commodity price is in the thousands (1000 to 9999) then we should round to the nearest integer (whole number).
This decision was based on the gold price and its inherent volatility. Even when using live prices there will always be some latency which means that the price may have changed by the time you receive the price or use it in the calculators.
Over a short period of time we can be reasonably certain that the price would not have deviated much from the time the live price was retrieved.
From this level of uncertainty and rounding to that level of precision, we worked up and down using a consistent approach based on the order of magnitude of the number.
When outside of the bounds of the rounding algorithm we are not rounding at all; hence the difference is 0%.
We can see by the example below that the result of the rounding algorithm is a fraction of 0.1% with the test numbers we used below.
Despite this, the rounding algorithm may result is notable absolute deviation when dealing with very large numbers (either from low currency values and/or large quantities of precious metals).
For example, 12345678.9 is rounded to be 4321.1 different from the original number - in absolute terms this seems like a lot, however, in relative terms it is quite small.
Running the rounding algorithm function and a series of numbers to test the algorithm:
Input: 0.000123456789 Output: 0.000123456789 Difference: 0%
Input: 0.00123456789 Output: 0.001235 Difference: 0.035%
Input: 0.0123456789 Output: 0.01235 Difference: 0.035%
Input: 0.123456789 Output: 0.1235 Difference: 0.035%
Input: 1.23456789 Output: 1.235 Difference: 0.035%
Input: 12.3456789 Output: 12.35 Difference: 0.035%
Input: 123.456789 Output: 123.5 Difference: 0.035%
Input: 1234.56789 Output: 1235 Difference: 0.035%
Input: 12345.6789 Output: 12350 Difference: 0.035%
Input: 123456.789 Output: 123500 Difference: 0.035%
Input: 1234567.89 Output: 1235000 Difference: 0.035%
Input: 12345678.9 Output: 12350000 Difference: 0.035%
Input: 123456789 Output: 123456789 Difference: 0%