|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-01-10 13:29 UTC] johannes@php.net
-Status: Open
+Status: Not a bug
[2013-01-10 13:29 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 08:00:01 2025 UTC |
Description: ------------ Putting an (int) in front of brackets creates a wrong result - or at least an unexpected result. Output of below script is actually: input = 0.58, output = 57 test3 = 58 test4 = 57 ("0.58"*100) creates a correct 58 (int) ("0.58"*100) gives an incorrect 57 The same happens with input of "0.29", where the output = is 28. It happens on intel as well as AMD cpus. Test script: --------------- $test = "0.58"; $test2 = (int) ($test*100); $test3 = ($test*100); $test4 = (int) ($test*100); echo "input = $test, output = $test2\n"; echo "test3 = $test3\n"; echo "test4 = $test4\n"; Expected result: ---------------- I would expect the output to be: input = 0.58, output = 57 test3 = 58 test4 = 58 Actual result: -------------- Current output: input = 0.58, output = 57 test3 = 58 test4 = 57