[PHP] cast changes value

2010-08-19 Thread Cassiano Dal Pizzol
http://www.php.net/manual/en/language.types.float.php *Warning* Floating point precision It is typical that simple decimal fractions like *0.1* or *0.7* cannot be converted into their internal binary counterparts without a small loss of precision. This can lead to confusing results: for example,

Re: [PHP] cast changes value

2010-08-19 Thread Paul M Foster
On Thu, Aug 19, 2010 at 03:46:37PM -0300, Martín Marqués wrote: > I have values with 2 decimals that I multiple by 100 to make them > integers, but to be sure I do a cast using (int). > > The thing is that (int) is changing the value of the integer. Here is > a var_dump of the original value, the

[PHP] cast changes value

2010-08-19 Thread Martín Marqués
I have values with 2 decimals that I multiple by 100 to make them integers, but to be sure I do a cast using (int). The thing is that (int) is changing the value of the integer. Here is a var_dump of the original value, the value * 100, and the value after casting to int. string(5) "34.80" float(