Share via

Computer Calculator and Microsoft Excel Programming

Anonymous
2015-11-06T16:40:36+00:00

Why are the computer calculator and Microsoft Excel programmed differently?  Example: If I try to divide 110,534,964,875,444 / 35,184,372,088,832 = 3.14159265358979 in Excel, but in the computer calculator we get 110,534,964,875,444 / 35,184,372,088,832 = 3.14159265358978.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. Anonymous
    2015-11-07T23:30:05+00:00

    > ... 110,534,964,875,444 / 35,184,372,088,832 = 3.14159265358979

    Hi.  Just for a side note, your rational number can actually be reduced..

    110534964875444 / 35184372088832

    Equals:

     27633741218861 /  8796093022208

    Were you trying to find a rational number for Pi?

    If interested, the 'smallest' rational number that Excel can calculate as Pi at machine precision would be:

    80143857 / 25510582

    =EXACT(PI(),  80143857 / 25510582)

    True

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2015-11-06T21:59:09+00:00

    Michael wrote:

    Yes, calculator under accessories, version 6.1

    Okay.  My calculator version is 5.1.

    In any case, did I answer your question?  If not, what more are you looking for in an answer?

    Bear in mind that none of us has knowledge of the internal implementation of these applications.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2015-11-06T21:40:04+00:00

    Yes, calculator under accessories, version 6.1

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2015-11-06T21:08:17+00:00

    PS....  I wrote:

    In Excel 2010 and WinXP (my versions), the two return exactly the same, namely:

    3.1415926535897824578569270670413970947265625.

    Excel formats only up to the first 15 significant digits, rounding the 16th.  So we see 3.14159265358978.

    But the Excel PI function returns exactly

    3.141592653589793115997963468544185161590576171875,

    which Excel displays as 3.14159265358979. <wink>

    Aside....  We should not use Excel or any (most) computer programmers to try to duplicate or validate mathematical results.

    Computer arithmetic differs from mathematics because mathmetical calculations have an unbounded number of digits, whereas computer arithmetic has a limited number of digits, even if it is extensible.  (The amount of memory is finite.)

    Was this answer helpful?

    0 comments No comments
  5. Anonymous
    2015-11-06T20:44:58+00:00

    Michael wrote:

    Why are the computer calculator and Microsoft Excel programmed differently?  Example: If I try to divide 110,534,964,875,444 / 35,184,372,088,832 = 3.14159265358979 in Excel, but in the computer calculator we get 110,534,964,875,444 / 35,184,372,088,832 = 3.14159265358978.

    What do you mean by "computer calculator"?  If you mean the calculator that we find under Accessories by clicking on Start / All Programs, what version of Windows do you have?

    In Excel 2010 and WinXP (my versions), the two return exactly the same, namely:

    3.1415926535897824578569270670413970947265625.

    [Errata....  I can only assume the Calculator gets the same result tothat degree of precision.]

    Excel formats only up to the first 15 significant digits, rounding the 16th.  So we see 3.14159265358978.

    Windows Calculator formats up to the first 32 significant digits, rounding the 33nd.  So we see 3.1415926535897824578569270670414.

    (I might have changed some Calculator options in order to see so many digits.  I don't remember.)

    In any case, infinitesimal differences are certainly possible, especially when there is more than one arithmetic operation.  There can be several reasons.  Among them:

    1. Differences in binary representation of stored numbers.  64-bit floating-point is the most common; it is the native binary form for most computers.  But some computers support other binary forms.  And we can always implement different forms in software.
    2. Differences in precision of binary computation and intermediate results of subexpressions.  In Intel-compatible CPUs, binary arithmetic is performed using an 80-bit floating-point form; intermediate results in that form are available to software.  That is why Excel and VBA sometimes have different results:  VBA tries to use the 80-bit intermediate results, whereas Excel rounds each subexpression to the 64-bit form.  And again, we can always do things differently in software.

    Was this answer helpful?

    0 comments No comments