ID: 13550 Updated by: rasmus Reported By: [EMAIL PROTECTED] Old Status: Open Status: Bogus Bug Type: *Programming Data Structures Operating System: Linux 2.2.18 PHP Version: 4.0.6 New Comment:
Could you be a little less cryptic please? I would expect this to print: int 2 float 100 string '8.78' float 8.78 float 878 int 878 int 878 Which is exactly what I am seeing. $scaled = 8.78 * 100.0 which gives a double value of 878.00 therefore round(878.00) would be 878 and intval(878) is 878. What exactly are you expecting to be different here? Previous Comments: ------------------------------------------------------------------------ [2001-10-04 19:08:52] [EMAIL PROTECTED] It seems that intval does not round off double numbers like the function that prints those numbers. Try this script to see the problem. <? $decimal_places=2; $decimal_factor=pow(10.0,$decimal_places); $value='8.78'; $double=doubleval($value); $scaled=$double*$decimal_factor; $integer=intval($scaled); $round=intval(round($scaled)); var_dump($decimal_places,$decimal_factor,$value,$double,$scaled,$integer,$round); ?> ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13550&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]