Results 1 to 2 of 2
  1. #1
    nello87to is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Aug 2016
    Posts
    14

    Problem in the sum of two double number

    Hi,
    I have a sub routine in a script of my access DB that perform the calculation between two double numbers.
    This is the instruction:

    matrix(r, c) = matrix(r, c) + importo

    matrix is defined as 'Dim matrix(23, 5) As Double'
    and importo is a parameter value 'Sub SommaImporti(colonnaSomma, importo, t)'

    The calculation works well, but at one point I have this:
    74390632,95 + 6255,5 = 74396888,45
    74396888,45 + 90945,17 = 74487833,62
    74487833,62 + 43855,12 = 74531688,7400001
    74531688,7400001 + 24311,37 = 74556000,1100001
    74556000,1100001 + 44099,73 = 74600099,8400001
    74600099,8400001 + 2551,62 = 74602651,4600001



    I don't understand why the sum of 74487833,62 + 43855,12 returns 74531688,7400001

    What could be the mistake?

    Thanks,
    Nello

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Well, Double is a floating point data type so it can represent values that way. I'd say use Currency but it only handles 4 decimals, so maybe try Decimal? If it's not a VBA data type, then you're probably looking at converting values and using Int().
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 8
    Last Post: 06-16-2015, 02:05 AM
  2. Replies: 0
    Last Post: 10-22-2012, 02:45 PM
  3. Sequential number problem
    By jfn15 in forum Programming
    Replies: 1
    Last Post: 06-21-2012, 09:33 AM
  4. double update query problem
    By tss in forum Queries
    Replies: 9
    Last Post: 11-04-2011, 08:50 AM
  5. slight number problem
    By Rigsby in forum Database Design
    Replies: 3
    Last Post: 01-06-2011, 11:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums