Luis Colorado wrote:
I think you have found a very interesting bug in the rand() function! I guess you should have the honor to report it to IBM.

Very interesting finding. Although I agree that it is rather uncommon, given a large enough sample, this could break your programs.
Even more fun... I created a field 31 digits long with 30 decimals.

I simply inserted rand() into that field and in 100,000 iterations I got five instances of 1.000000000(...).

So, whatever the precision used for rand(), it's evidently more than 31 decimals, and that's a little scary.

I then upped the field size to 63 digits with 62 decimals. SQL can't even display that; you get an overflow error. But by using DIGITS I was able to check and see if the first digit was a one, and again I got five instances of 1. Which means the precision is even greater than 62 digits, which means you will get false endpoints.

Joe



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.