Re: [RFC] Floating Point support in GMP extension

From: Date: Wed, 23 Apr 2014 22:43:32 +0000
Subject: Re: [RFC] Floating Point support in GMP extension
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-73769@lists.php.net to get a copy of this message
Ok, add precision param to gmp_init.

gmp_init ( mixed $number [, int $base = 0 ],  int $precision = 0]] )
$a = gmp_init (3); // type float, by precision = 0
$b = gmp_init (3.333, 10, 3); // float
$c = $a + $b; // float


2014-04-22 0:07 GMT+03:00 Johannes Schlüter <johannes@schlueters.de>:

> On Mon, 2014-04-21 at 23:40 +0300, Park Framework wrote:
> > For backward compatibility in php.ini set default values
> > ​​gmp.default_precision = 0
>
> No. INI setting is *not* backwards compatibility. An ini setting means
> that *everybody* has to care about it and mind it and either check or
> set it.
>
> An alternative is a runtime setting (gmp_set_compatiility(true) ), in
> case the change is really important. I haven't looked further but
> behavior should not depend on ini. We made the mistake and should learn
> not repeat.
>
> johannes
>
>


Thread (9 messages)

« previous php.internals (#73769) next »