rfc:gmp_number

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:gmp_number [2013/12/30 23:53]
yohgaki
rfc:gmp_number [2017/09/22 13:28] (current)
Line 23: Line 23:
  
 ==== Add GMP float support to GMP module ==== ==== Add GMP float support to GMP module ====
-Add GMP float support to GMP module.+<del>Add GMP float support to GMP module.
  
   * Add all GMP float API wrapper to module.   * Add all GMP float API wrapper to module.
   * GMP float API wrapper supports PHP int/float and GMP int/float. Conversion is done automatically.   * GMP float API wrapper supports PHP int/float and GMP int/float. Conversion is done automatically.
-  * Default precision: 256 (?)+  * Default precision: 256 (?)</​del>​
  
-==== Add GMP float support to Zend OP ===== +Extracted out to a separate RFC: [[rfc:​gmp-floating-point|GMP Floating Point Support]]
-Add GMP float support to operators. +
- +
-  * Arithmetic with GMP float and any number(PHP int/float, GMP int) is promoted ​to GMP float.+
  
 ==== Add math function compatibility ===== ==== Add math function compatibility =====
Line 72: Line 69:
   bool(false)   bool(false)
   bool(false)   bool(false)
 +
 +
 +== Current math function behavior ==
 +
 +GMP float is not supported.
 +  php > $f = 2.2;
 +  php > $gf = gmp_init($f);​
 +  ​
 +  Warning: gmp_init(): Unable to convert variable to GMP - wrong type in php shell code on line 1
 +
 +max()/min()
 +  php > $g = gmp_init(123);​
 +  php > var_dump($v);​
 +  object(GMP)#​4 (1) {
 +    ["​num"​]=>​
 +    string(1) "​0"​
 +  }
 +  php > $g = gmp_init(5);​
 +  php > var_dump(max(1,​2,​$g));​
 +  object(GMP)#​1 (1) {
 +    ["​num"​]=>​
 +    string(1) "​5"​
 +  }
 +  php > var_dump(min(1,​2,​$g));​
 +  int(1)
 +  php > var_dump(min($g,​ 6, 7));
 +  object(GMP)#​1 (1) {
 +    ["​num"​]=>​
 +    string(1) "​5"​
 +  }
  
  
Line 98: Line 125:
  
 PHP 5.6 or later PHP 5.6 or later
- 
-===== Impact to Existing Extensions ===== 
- 
-GMP module will have GMP float support. 
- 
-===== php.ini Defaults ===== 
- 
-If there are any php.ini settings then list: 
- 
-  * hardcoded default values 
-     * gmp_precision=256 
- 
-  * php.ini-development values 
-     * gmp_precision=256 
- 
-  * php.ini-production values 
-     * gmp_precision=256 
  
 ===== Open Issues ===== ===== Open Issues =====
Line 123: Line 133:
     * Implement autoboxing like feature     * Implement autoboxing like feature
   * How GMP number should behave (Like PHP or Ruby?)   * How GMP number should behave (Like PHP or Ruby?)
-  * GMP float support API design 
-  * gmp_precision default value 
  
 ===== Future Scope ===== ===== Future Scope =====
Line 153: Line 161:
  
 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/gmp_number.1388447617.txt.gz · Last modified: 2017/09/22 13:28 (external edit)