"Andrew G. Koptyaev" <ko******@gmail.comwrote:

>

As I understand PC with x86 CPU is IEEE754 floating point standart.

Then out of:

<?php

print (19.6*100)!==(double)1960;

?>

will be 1.

It's true ?

As Jerry said, you can find out for yourself whether this prints 1 or not.

However, I would like to point out that IEEE-754 compliance does NOT

guarantee the result. 19.6 cannot be represented exactly in binary. In

binary, it is an infinitely repeating value. Thus, the floating point

representation will be an approximation -- very close to 19.6, but not

exactly equal.

When you multiply by 100, it is quite difficult (without knowing the exact

binary representation) to predict whether rounding will help or hurt.

--

Tim Roberts,

ti**@probo.com
Providenza & Boekelheide, Inc.