rfc:gmp-floating-point
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
rfc:gmp-floating-point [2014/01/04 07:00] – created pollita | rfc:gmp-floating-point [2014/01/05 22:38] – pollita | ||
---|---|---|---|
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' | @yohgaki suggested adding support for libgmp' | ||
- | ===== Proposal ===== | + | ===== Proposal |
Extend `gmp_object` struct to the following: | Extend `gmp_object` struct to the following: | ||
Line 33: | Line 33: | ||
Add gmp_floatval(), | Add gmp_floatval(), | ||
+ | |||
+ | ===== Proposal #2 ===== | ||
+ | |||
+ | Rather than overload the GMP class for integer/ | ||
+ | |||
+ | 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 ===== | ||
- | gmp_init_float() is being added to specifically avoid breakage in code currently supplying numbers which may (or may not) have decimal separators in them. | + | gmp_init_float() is being added to specifically avoid breakage in code currently supplying numbers which may (or may not) have decimal separators in them. |
Actor functions and operator overloads should remain unaffected (with one exception, below) as code producing gmp_objects now will continue to do so, with the single (invisible) addition of the type byte. | Actor functions and operator overloads should remain unaffected (with one exception, below) as code producing gmp_objects now will continue to do so, with the single (invisible) addition of the type byte. | ||
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.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1