|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesitsAGeneralIssue (last revision 2018-03-16 13:06 UTC by mail at fsax dot ch)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-03-16 14:34 UTC] cmb@php.net
-Status: Open
+Status: Not a bug
-Assigned To:
+Assigned To: cmb
[2018-03-16 14:34 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 12:00:01 2025 UTC |
Description: ------------ Some String to Number conversions create unexpected results that can lead to bad miscalculations. On the php.net docs i found a warning: "Never cast an unknown fraction to integer, as this can sometimes lead to unexpected results." but i think the root of my issue manifests while the float is beeing cast, since the floor() has the same result. Test script: --------------- echo ("9312.80" *100)."<br>\n"; echo (((float) "9312.80") *100)."<br>\n"; echo (int) ("9312.80" *100)."<br>\n"; echo floor( "9312.80" *100); Expected result: ---------------- 237280<br> 237280<br> 237280<br> 237280 Actual result: -------------- 237280<br> 237280<br> 931279<br> 931279