Re: [RFC] Floating Point support in GMP extension
| From: | Nikita Popov | Date: | Thu, 24 Apr 2014 08:17:18 +0000 |
| Subject: | Re: [RFC] Floating Point support in GMP extension | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-73771@lists.php.net to get a copy of this message | ||
On Mon, Apr 21, 2014 at 10:40 PM, Park Framework
<park.framework@gmail.com>wrote:
> Concept is simple.
> Need, remove GMPInt, leave only GMPFloat.
> For backward compatibility in php.ini set default values
> gmp.default_precision = 0
> Anyone who wants to work with float, must specify precision > 0
> What do you think about this?
>
This is not possible, because GMP integers and GMP floats are fundamentally
and inherently different types.
A GMP integer isn't just a GMP float with zero precision. Actually, what I
think you're missing here is that the GMP floating point type is just that:
A **floating** point type. This means that it is **not** precise. What you
specify as the GMP float precision actually translates to the size of the
mantissa/significand, not the number of places after the comma.
GMP integers on the other hand are precises. Furthermore a primary
application for GMP integers are computations over cyclic groups, as well
as other number theoretic computations. The operations for these are not a
available for the floating point type (and frankly, wouldn't really make
sense).
Maybe you're looking for the BCMath extension?
Nikita