| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2020-10-27 08:55 UTC] daverandom@php.net
 
-Summary:          Math operation with precision in
                   php.ini
+Summary:          Changing precision ini setting has
                   no effect on const expressions
-Status:           Open
+Status:           Verified
-Operating System: Linux Ubuntu 20.04 LTS
+Operating System: Any
-PHP Version:      7.3.23
+PHP Version:      >=7
  [2020-10-27 08:55 UTC] daverandom@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
Description: ------------ Math operations ignores precision option in php.ini (php 7+); Precision is works for PHP 5. Test script: --------------- <?php $precision = 18; while($precision--) { ini_set('precision', $precision); echo $precision.":".(342349.23 - 341765.07)."\n"; } Expected result: ---------------- 17:584.15999999997439 16:584.1599999999744 15:584.159999999974 14:584.15999999997 13:584.16 12:584.16 11:584.16 10:584.16 9:584.16 8:584.16 7:584.16 6:584.16 5:584.16 4:584.2 3:584 2:5.8E+2 1:6.0E+2 0:6.0E+2 Actual result: -------------- 17:5.8E+2 16:5.8E+2 15:5.8E+2 14:5.8E+2 13:5.8E+2 12:5.8E+2 11:5.8E+2 10:5.8E+2 9:5.8E+2 8:5.8E+2 7:5.8E+2 6:5.8E+2 5:5.8E+2 4:5.8E+2 3:5.8E+2 2:5.8E+2 1:5.8E+2 0:5.8E+2