rfc:precise_float_value

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:precise_float_value [2015/09/25 00:00] yohgakirfc:precise_float_value [2016/02/25 01:25] yohgaki
Line 60: Line 60:
 ===== Proposal ===== ===== Proposal =====
  
-  * PHP 7.0: Introduce EG(precision)=-1 and PG(serialize_precision)=-1 that uses zend_dtoa()'s 0 mode that rounds to nearest value. (-1 is used to indicate 0 mode)+  * PHP 7.1: Introduce EG(precision)=-1 and PG(serialize_precision)=-1 that uses zend_dtoa()'s 0 mode that rounds to nearest value. (-1 is used to indicate 0 mode)
  
 Since JSON is used extensively for web apps, we may have JSON specific INI setting for better compatibility and ease of use. Since JSON is used extensively for web apps, we may have JSON specific INI setting for better compatibility and ease of use.
Line 123: Line 123:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-PHP 7.will have 0 mode as the default. var_export()/serialize() may have different number. +PHP 7.will have 0 mode as the default. var_export()/serialize() may have different number. 
  
 FYI: Existing tests passes even when 0 mode is used. FYI: Existing tests passes even when 0 mode is used.
Line 131: Line 131:
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
  
-  * PHP 7.0.0 - EG(precision)/PG(serialize_precision) 0 mode and JSON_G(json_precision) that support 0 mode. +  * PHP 7.1.0 - EG(precision)/PG(serialize_precision) 0 mode and JSON_G(json_precision) that support 0 mode. 
-  * PHP 5.6.x - JSON uses PG(serialize_precision) for float precision.+  * PHP 5.6.x/7.0.0 - JSON uses PG(serialize_precision) for float precision.
  
 ===== RFC Impact ===== ===== RFC Impact =====
Line 143: Line 143:
  
 Standard module Standard module
-  * serialize(), var_export() - PHP7.0: Use PG(serialieze_precision) and 0 mode.+  * serialize(), var_export() - PHP7.1: Use PG(serialieze_precision) and 0 mode.
  
 JSON JSON
-  * json_encode() - PHP7.0: Use PG(serialize_precision) and 0 mode. PHP5.6: Use PG(serialize_precision).  It uses EG(precision) currently.+  * json_encode() - PHP7.1: Use PG(serialize_precision) and 0 mode. PHP5.6/7.0: Use PG(serialize_precision).  It uses EG(precision) currently. If JSON_G(json_precision) is accepted, use it instead of PG(serialize_precision).
  
  
Line 164: Line 164:
   * php.ini-production values : 14 Unmodified   * php.ini-production values : 14 Unmodified
  
-serialize_precision(PHP5.6)+serialize_precision(PHP5.6/7.0)
   * hardcoded default values : 17 Unmodified   * hardcoded default values : 17 Unmodified
   * php.ini-development values : 17 Unmodified   * php.ini-development values : 17 Unmodified
   * php.ini-production values : 17 Unmodified   * php.ini-production values : 17 Unmodified
  
-serialize_precision(PHP7)+serialize_precision(PHP7.1)
   * hardcoded default values : -1   * hardcoded default values : -1
   * php.ini-development values : -1   * php.ini-development values : -1
   * php.ini-production values : -1   * php.ini-production values : -1
  
-json_precision(NEW - PHP7 only)+json.precision(NEW - PHP7.1 only)
   * hardcoded default values : -1   * hardcoded default values : -1
   * php.ini-development values : -1   * php.ini-development values : -1
Line 206: Line 206:
 Please choose Yes/No for 0 mode EG(precision)/PG(serialize_precision) Please choose Yes/No for 0 mode EG(precision)/PG(serialize_precision)
  
-<doodle title="Introduce 0 mode to EG(precision)/PG(serialize_precision) for PHP 7.0" auth="yohgaki" voteType="single" closed="True">+<doodle title="Introduce 0 mode to EG(precision)/PG(serialize_precision) for PHP 7.1" auth="yohgaki" voteType="single" closed="True">
    * Yes    * Yes
    * No    * No
Line 215: Line 215:
 Please choose your preference whether JSON module should use PG(serialize_precision) or new JSON_G(json_precision). i.e. JSON module has its own precision setting or not. Please choose your preference whether JSON module should use PG(serialize_precision) or new JSON_G(json_precision). i.e. JSON module has its own precision setting or not.
  
-<doodle title="Add JSON_G(json_precision) for JSON module only setting for PHP 7.0" auth="yohgaki" voteType="single" closed="True">+<doodle title="Add JSON_G(json_precision) for JSON module only setting for PHP 7.1" auth="yohgaki" voteType="single" closed="True">
    * Yes    * Yes
    * No    * No
Line 228: Line 228:
    * No    * No
 </doodle> </doodle>
 +
 +Please choose if PHP 7.0's JSON should use PG(serialize_precision) or EG(precision). Currently it uses EG(precision).
 +
 +<doodle title="Make json_encode() uses PG(serialize_precision) for PHP 7.0" auth="yohgaki" voteType="single" closed="True">
 +   * Yes
 +   * No
 +</doodle>
 +
  
  
Line 242: Line 250:
 ===== References ===== ===== References =====
  
-https://marc.info/?l=php-internals&m=143786181229714&w=2+  * https://marc.info/?l=php-internals&m=143786181229714&w=2 
 +  * https://bugs.php.net/bug.php?id=71473 
 +  * http://blog.reverberate.org/2016/02/06/floating-point-demystified-part2.html
  
 ===== Rejected Features ===== ===== Rejected Features =====
 Keep this updated with features that were discussed on the mail lists. Keep this updated with features that were discussed on the mail lists.
  
rfc/precise_float_value.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1