#30903 [Opn->Bgs]: (int) doesn't work as expected

From: Date: Fri, 26 Nov 2004 09:35:02 +0000
Subject: #30903 [Opn->Bgs]: (int) doesn't work as expected
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-69469@lists.php.net to get a copy of this message
ID: 30903 Updated by: derick@php.net Reported By: ndesmet at matedex dot be -Status: Open +Status: Bogus Bug Type: Scripting Engine problem Operating System: windows 2000 PHP Version: 5.0.2 New Comment: Floating point values have a limited precision. Hence a value might not have the same string representation after any processing. That also includes writing a floating point value in your script and directly printing it without any mathematical operations. Thank you for your interest in PHP. . Previous Comments: ------------------------------------------------------------------------ [2004-11-26 10:28:39] ndesmet at matedex dot be Description: ------------ Problem with truncate function. Reproduce code: --------------- print ( ((4.06*75)+0.5) ); print("<BR>"); print ( (int) ((4.06*75)+0.5) ); Expected result: ---------------- 305 305 Actual result: -------------- 305 304 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=30903&edit=1

« previous php.bugs (#69469) next »