xref: /PHP-5.6/ext/standard/tests/math/bug25694.phpt (revision 3a46e8ab)
1--TEST--
2Bug #25694 (round() and number_format() inconsistency)
3--INI--
4precision=14
5--FILE--
6<?php
7echo "round 0.045 = " . round(0.045, 2) . "\n";
8echo "number format 0.045 = " . number_format(0.045, 2) . "\n\n";
9echo "round 0.055 = " . round(0.055, 2) . "\n";
10echo "number format 0.055 = " . number_format(0.055, 2) . "\n\n";
11echo "round 5.045 = " . round(5.045, 2) . "\n";
12echo "number format 5.045 = " . number_format(5.045, 2) . "\n\n";
13echo "round 5.055 = " . round(5.055, 2) . "\n";
14echo "number format 5.055 = " . number_format(5.055, 2) . "\n\n";
15echo "round 3.025 = " . round(3.025, 2) . "\n";
16echo "number format 3.025 = " . number_format(3.025, 2) . "\n\n";
17echo "round 4.025 = " . round(4.025, 2) . "\n";
18echo "number format 4.025 = " . number_format(4.025, 2) . "\n\n";
19?>
20--EXPECT--
21round 0.045 = 0.05
22number format 0.045 = 0.05
23
24round 0.055 = 0.06
25number format 0.055 = 0.06
26
27round 5.045 = 5.05
28number format 5.045 = 5.05
29
30round 5.055 = 5.06
31number format 5.055 = 5.06
32
33round 3.025 = 3.03
34number format 3.025 = 3.03
35
36round 4.025 = 4.03
37number format 4.025 = 4.03
38