rfc:gmp-floating-point

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
rfc:gmp-floating-point [2014/01/04 07:20] – typo pollitarfc:gmp-floating-point [2017/09/22 13:28] (current) – external edit 127.0.0.1
Line 1: Line 1:
  
 ====== PHP RFC: GMP Floating Point Support ====== ====== PHP RFC: GMP Floating Point Support ======
-  * Version: 1.0+  * Version: 1.1
   * Date: 2014-01-04   * Date: 2014-01-04
   * Author: Sara Golemon, pollita@php.net   * Author: Sara Golemon, pollita@php.net
Line 11: Line 11:
 @yohgaki suggested adding support for libgmp's arbitrary precision floating point numbers to the PHP extension, and I offered to implement it, so here's my proposal. @yohgaki suggested adding support for libgmp's arbitrary precision floating point numbers to the PHP extension, and I offered to implement it, so here's my proposal.
  
-===== Proposal =====+===== Proposal #1 =====
  
 Extend `gmp_object` struct to the following: Extend `gmp_object` struct to the following:
Line 33: Line 33:
  
 Add gmp_floatval(), gmp_isint(), gmp_isfloat(), and similar introspection functions. Add gmp_floatval(), gmp_isint(), gmp_isfloat(), and similar introspection functions.
 +
 +===== Proposal #2 =====
 +
 +Rather than overload the GMP class for integer/float representations, organize Integer and Floating-Point GMP objects into a class heirarchy as so:
 +
 +  abstract class GMPNumber {}
 +  class GMPInt extends GMPNumber {}
 +  class GMPFloat extends GMPNumber {}
 +
 +The same open questions exist for this approach (i.e. should int/int yield float?)
  
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
Line 54: Line 64:
 Add INI setting: Add INI setting:
 gmp.default_precision=(libgmp-initial-default-precision) gmp.default_precision=(libgmp-initial-default-precision)
 +
 +===== History =====
 +
 +  * Version 1.0: 2014-01-04 Initial Draft
 +  * Version 1.1: 2014-01-05 Added proposal #2
  
 ===== Implementation ===== ===== Implementation =====
rfc/gmp-floating-point.1388820028.txt.gz · Last modified: 2017/09/22 13:28 (external edit)