It's a while since I considered floating point numbers but I think we are talking about numbers that are in the order of
POINT 103 zeroes and some digits .000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000043008 I think adding three more zeroes to the number is really irrelevant. I do take Wol's point on scaling though. I suspect the original enquirer didn't realise the significance of the "E" in the comparison. They might just be comparing membership numbers or something. Well that was the case when I stumbled on the "bug"! Another 1c worth, Louis ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, January 12, 2005 9:43 PM Subject: Re: [U2] [UV]Strange But True : [EMAIL PROTECTED] wrote: : > I don't know if it is intentional but the values you are comparing : > are exponential. : > : > So the comparison is of two incredibly small numbers. The : > numbers are so small they are equal for all intents or purposes. : > : "small" is subjective. The earth is only rounding error as far as the universe is concerned, but it is very important to us. : : To my mind this is a major bug, if you're right. It's as bad as "IF 100 = 0.01" were to return TRUE. (Which is exactly the same comparison, scaled up.) : : The correct way of dealing with rounding error is for the internal logic to be along the lines of "IF (A-B)/A < 1E-6 THEN RETURN TRUE ELSE RETURN FALSE". : : While I'm pretty certain 6 is the wrong number, there is a concrete justification for it - when comparing FLOAT*4 numbers it guarantees that you are using the best available precision without falling over processor rounding artifacts. There is a similar number for FLOAT*8, which is what I think UV uses internally. (And I'm assuming A and B are positive, correct appropriately for negative numbers :-) : : Cheers, : Wol : ------- : u2-users mailing list : [email protected] : To unsubscribe please visit http://listserver.u2ug.org/ : : : : : -- : Internal Virus Database is out-of-date. : Checked by AVG Anti-Virus. : Version: 7.0.296 / Virus Database: 265.6.8 - Release Date: 3/01/2005 : : -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.296 / Virus Database: 265.6.8 - Release Date: 3/01/2005 ------- u2-users mailing list [email protected] To unsubscribe please visit http://listserver.u2ug.org/
