The INT function

tmyers

Well-known member
Local time
Today, 11:39
Joined
Sep 8, 2020
Messages
1,091
I have a question that involves the INT function within Access.
I have been using it to do my rounding to the nearest tenth but just have a single anomaly that I cant seem to explain.

My expression is INT(-10*[Price]/(1-[GP]))/-10.
When I ran this against $19.00 with a 5% GP value, it returned $20.10. When I put this into our Excel sheet and take $19.00 and divide it by .95, I get $20.00 even as well as when I simply do it in a calculator.

Can anyone explain why a .10 appeared? At the end of the day it rounded up so it would be in our favor, but I worry that something like that could happen elsewhere and next time it might not just be a dime worth.
 
Can anyone explain why a .10 appeared?
Hi. I think it may have to do with "negative" numbers. I'll have to find a reference to verify that thought.
 
My expression is INT(-10*[Price]/(1-[GP]))/-10.
When I ran this against $19.00 with a 5% GP value, it returned $20.10.

I think you screwed up your inputs or your formula in your database. I created a table with those fields, input 19 for the price and .05 for the GP and created a query with your function and it spit out 20.
 
TheDBguy's original thought is correct. There is a marked difference between INT and FIX when dealing with negative numbers, and I think MAYBE you might have used the wrong one.


The INT of a negative number rounds DOWN (away from zero) because INT returns the greatest integer LESS THAN the input number. The FIX of a negative number rounds to the number for which ABS(FIX(number)) is smaller than ABS(number) - i.e. towards zero.
 

Users who are viewing this thread

Back
Top Bottom