Forum Discussion
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
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- robertallen2405Copper Contributor
Thank you (especially for your reply being so quick).
You were right, it was Single; which I'd done to try and save storage space. But, it's no good if you can't perform even basic mathematical functions on them!
Changed it to currency and it worked like a dream.
Thanks again.
- Ken_SheridanCopper Contributor
You might find the following link of interest:
https://www.sfmagazine.com/articles/2017/march/access-numbers/