Forum Discussion

robertallen2405's avatar
robertallen2405
Copper Contributor
Sep 20, 2024
Solved

Adding two numbers in a select query produces a slightly different number.

In a select query, the Field contains 'Total Net (inc Manual): [Manually Input Amount]+[Net Amount]'. 

In one example, it should produce 20.6, but it produces 20.6000003814697.

Both values do not contain more than 2 decimal places, so it's not a formatting issue ([Manually Input Amount] is 0 and [Net Amount] is 20.6).

I've tried running it as 'Total Net (inc Manual): [Net Amount]+0'; as in this instance the [Manually Input Amount] was 0, but I still get the same result (20.6000003814697 instead of 20.6).

When I run this against a whole table, many values are slightly out, but not all of them. 

I'm completely baffled, so any help would be appreciated.

  • Hi,

     

    Since you didn't reveal the data type of [Net Amount] in the underlying table, I can only guess that it is Single. If that's the case: This is the least useful and most inaccurate data type in the world. 😉 Change it to Double at the very least, or better yet, to Currency.

     

    Servus
    Karl
    ****************

    Access Forever News DevCon
    Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg

3 Replies

Resources