Frequently asked questions - Calc: Accuracy problem

    From The Document Foundation Wiki
    < Faq‎ | Calc
    This page contains changes which are not marked for translation.
    Other languages:


    Inherent Accuracy Problem

    Calc, just like most other spreadsheet software, uses floating-point math capabilities available on hardware. Given that most contemporary hardware uses binary floating-point arithmetic with limited precision defined in IEEE 754, many decimal numbers - including as simple as 0.1 - cannot be precisely represented in Calc (which uses 64-bit double-precision numbers internally). Calculations with those numbers necessarily results in rounding errors, and those accumulate with every calculation. This is not a bug, but is expected and currently unavoidable without using complex calculations in software, which would incur inappropriate performance penalties, and thus is out of question. Users need to account for that, and use rounding and comparisons with epsilon as necessary.

    An example:

    A
    1 31000.99
    2 32000.12
    3 =A1-A2

    This will result in -999.129999999997 in A3, instead of expected -999.13 (you might need to increase shown decimal places in cell format to see this).

    Order of magnitude between operands

    The maximum order of magnitude between operands is lower than 10^15 (1015). This is not related to the display format for the cell.

    For instance, when performing 1E+9 + 1E-7 you might not get the result you are expecting, since 9 - (-7) = 16 > 15. On the other hand, performing 1E+8 + 1E-6 will indeed result in 100000000.000001 (you might need to increase shown decimal places in cell format to see this).

    See Also

    Related bookmarks collected by erAck