RE: [PHP] Strange math results

2006-03-28 Thread Jeff
> -Original Message- > From: Satyam [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 28, 2006 17:23 > To: [EMAIL PROTECTED]; Jay Blanchard > Cc: Jeff; php-general@lists.php.net > Subject: Re: [PHP] Strange math results > > > Indeed, when doing floating point

Re: [PHP] Strange math results

2006-03-28 Thread Satyam
Indeed, when doing floating point math, you cannot check the values for equality, they will rarely be, you have to check whether the difference in between them is less than the error you are willing to accept. Floating point numbers are usually an approximation to the actual value and interme

RE: [PHP] Strange math results

2006-03-28 Thread Ezra Nugroho
It is not always possible to precisely represent decimal values as a float type in binary. In these cases, the value that you have is either slightly bigger or slightly smaller than the actual. In your specific problem, you have two values that are not equal, but very similar. Therefore you get

RE: [PHP] Strange math results

2006-03-28 Thread Jay Blanchard
[snip] I've got a strange problem here. I'm subtacting one variable from another, both of type "double" and if they are the same, instead of getting a result of 0, I get something like -9.99200722163E-016 Is this a bug or am I doing something wrong here? [/snip] >From all of the information that

[PHP] Strange math results

2006-03-28 Thread Jeff
I've got a strange problem here. I'm subtacting one variable from another, both of type "double" and if they are the same, instead of getting a result of 0, I get something like -9.99200722163E-016 Is this a bug or am I doing something wrong here? Thanks, Jeff -- PHP General Mailing List (htt