+ Reply to Thread
Results 1 to 4 of 4

arithmetic series problem

  1. #1
    Registered User
    Join Date
    08-12-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    2

    Unhappy arithmetic series problem

    If I input the following arithmetic series with common difference 0.04:

    A1 = 7.96
    A2 = 8
    A3 = 8.04
    A4 = 8.08

    Then, if I check each time whether the common difference is 0.04 using the following formula:

    IF(A2-A1=0.04,"TRUE","FALSE")
    IF(A3-A2=0.04,"TRUE","FALSE")
    IF(A4-A3=0.04,"TRUE","FALSE")

    I get the following results:

    TRUE
    FALSE
    FALSE

    If I further continue the series and the checking formula, the result continues to be false, even if I use a formula like A2 = A1 + 0.04 to set my values.

    Can someone help me fix this bug?

    Thanks in advance,

    Matthias

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: arithmetic series problem

    Not a bug, see: http://support.microsoft.com/kb/78113

    Using the example you would be best served rounding to level of significance required, eg: =ROUND(A2-A1,2)=0.04

  3. #3
    Registered User
    Join Date
    08-12-2009
    Location
    Belgium
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: arithmetic series problem

    Thanks for your reply. It is not a bug indeed. However, it is somehow a pity that Excel doesn't take this into account when evaluating among others such comparison formulas. Simple equality checks now come out as false negatives, which may cause a lot of trouble in macros or applications that base on Excel data.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: arithmetic series problem

    Excel doesn't have much choice -- blame IEEE 754-1985, the standard that defines the binary floating-point formats used by most or all computers.

    On the other hand, there has been an alternative IEEE spec (854) that supports base 10 arithmetic, which has since been integrated into the latest version of 754 (2008), but is yet to see light of day in computers. So blame Intel.

    The discussion and links at http://en.wikipedia.org/wiki/IEEE_754-2008 are informative.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1