Some numbers can be represented exactly using the floating point type. 
According to ieee 754 spec:
"All integers that are a power of 2 can be stored in a 32 bit float without 
rounding
 Precision decreases exponentially as the exponent increases"

So for those numbers equality is necessary.


John Stanton <[EMAIL PROTECTED]> wrote: Dennis Cote wrote:
> John Stanton wrote:
>> The point about using floating point is that there is no equal, only 
>> less or greater, because it is an approximation.  If you want to use 
>> equality you must use some form of integer or fixed ppint numbers.
>>
> 
> That's not true at all. While it is not reliable to use equality tests 
> for different floating point numbers, there is very definitely the 
> possibility of two floating point numbers being equal.
> 
> For any two floating point numbers with the same bit pattern, both < and 
>  > will be false. All code using floating point numbers must be able to 
> handle the equal case correctly, it is usually just merged with one of 
> the < or > cases.
> 
> That is what Steve's correction was. He suggested it should merge the 
> equal case with the < case. It usually makes no sense to merge the < and 
>  > cases (this is simply another way to say not equal) as it was 
> originally documented.
> 
> Dennis Cote

But for practical arithmetic probability or possibility is not close 
enough.  It must be certainty.  I make the point because it has been my 
observation over the years that some of the silliest and most 
embarrassing simple IT errors have been caused by the inappropriate 
usage of floating point numbers.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to