Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Challenge: Algorithms having only one line of code.
#64
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.
*****
Reply


Messages In This Thread
To Oracle: 2nd look at your code. - by Moneo - 06-24-2003, 09:07 PM
To Seph and Agamemnus: - by Moneo - 06-24-2003, 09:17 PM
factorial. - by Agamemnus - 06-24-2003, 09:51 PM
To Agamemnus - by Moneo - 06-24-2003, 10:21 PM
To na_th_an: - by Moneo - 06-27-2003, 03:15 AM
ok, - by Agamemnus - 06-27-2003, 05:17 PM
To Oracle re Statlib - by Moneo - 06-27-2003, 10:39 PM
Re: To na_th_an: - by na_th_an - 06-28-2003, 01:14 AM
To LooseCaboose: - by Moneo - 06-28-2003, 03:08 AM
Re: To Oracle re Statlib - by oracle - 06-28-2003, 05:50 AM
To Oracle: - by Moneo - 06-29-2003, 03:10 AM
To Ak00ma: - by Moneo - 06-30-2003, 03:39 AM
Power of 2 - by Moneo - 07-02-2003, 02:42 AM
To Antoni: - by Moneo - 07-02-2003, 03:03 AM
197 - by whitetiger0990 - 07-02-2003, 06:29 PM
To na_th_an re "replacement" logic: - by Moneo - 07-02-2003, 08:29 PM
Re ROUNDING using .5: - by Moneo - 07-02-2003, 08:47 PM
Re: Re ROUNDING using .5: - by Moneo - 03-20-2006, 06:19 AM
Challenge: Algorithms having only one line of code. - by Moneo - 03-21-2006, 01:20 AM
Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:09 PM
Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:24 PM
Challenge: Algorithms having only one line of code. - by Anonymous - 03-29-2006, 10:52 PM
my one-liner - by neuro - 03-30-2006, 12:08 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)