Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
「+0.00000000000」と「+0.00000000000」をbccompで比較してみました。結果は 0 になると思っていましたが、実際には 1 になりました。
$ cat bcmath.php <?php var_dump(bccomp("+0.00000000000","-0.00000000000")); ?> $ php bcmath.php int(1) $
+0 と +0、または +0 と -0 を比較していますか。左オペランドが右オペランドよりも大きい場合、'1' が返されます。右オペランドが左オペランドよりも大きい場合、'-1' が返されます。等しい場合は「0」が返されます。左側の正と右側の負を比較すると、「1」が返されます。
var_dump(bccomp("+0.00000000000","-0.00000000000"));