bug25694.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. --TEST--
  2. Bug #25694 (round() and number_format() inconsistency)
  3. --INI--
  4. precision=14
  5. --FILE--
  6. <?php
  7. echo "round 0.045 = " . round(0.045, 2) . "\n";
  8. echo "number format 0.045 = " . number_format(0.045, 2) . "\n\n";
  9. echo "round 0.055 = " . round(0.055, 2) . "\n";
  10. echo "number format 0.055 = " . number_format(0.055, 2) . "\n\n";
  11. echo "round 5.045 = " . round(5.045, 2) . "\n";
  12. echo "number format 5.045 = " . number_format(5.045, 2) . "\n\n";
  13. echo "round 5.055 = " . round(5.055, 2) . "\n";
  14. echo "number format 5.055 = " . number_format(5.055, 2) . "\n\n";
  15. echo "round 3.025 = " . round(3.025, 2) . "\n";
  16. echo "number format 3.025 = " . number_format(3.025, 2) . "\n\n";
  17. echo "round 4.025 = " . round(4.025, 2) . "\n";
  18. echo "number format 4.025 = " . number_format(4.025, 2) . "\n\n";
  19. ?>
  20. --EXPECT--
  21. round 0.045 = 0.05
  22. number format 0.045 = 0.05
  23. round 0.055 = 0.06
  24. number format 0.055 = 0.06
  25. round 5.045 = 5.05
  26. number format 5.045 = 5.05
  27. round 5.055 = 5.06
  28. number format 5.055 = 5.06
  29. round 3.025 = 3.03
  30. number format 3.025 = 3.03
  31. round 4.025 = 4.03
  32. number format 4.025 = 4.03