03-21-2006, 01:20 AM
In my post of yesterday, I stated the following:
" .... I discovered that using a rounding factor of .5 or -.5 does not work 100% for reasons unknown."
Well, I wrote a little test program and discovered that the INT function in QB produces different results depending on the sign of the variable. An INT(-123.9) works differently than INT(123.9).
Since my original algorithm maintains the sign of the variable and uses a positive or negative rounding factor, then the INT with negative numbers does not always work like you would assume.
To appreciate this, you have to do some testing with the same positive and negative numbers with decimal values of .0, .4, .5, .6, and .9.
*****
" .... I discovered that using a rounding factor of .5 or -.5 does not work 100% for reasons unknown."
Well, I wrote a little test program and discovered that the INT function in QB produces different results depending on the sign of the variable. An INT(-123.9) works differently than INT(123.9).
Since my original algorithm maintains the sign of the variable and uses a positive or negative rounding factor, then the INT with negative numbers does not always work like you would assume.
To appreciate this, you have to do some testing with the same positive and negative numbers with decimal values of .0, .4, .5, .6, and .9.
*****