Re: Re: GMP and empty()
| From: | Yasuo Ohgaki | Date: | Mon, 30 Dec 2013 20:17:44 +0000 |
| Subject: | Re: Re: GMP and empty() | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-70925@lists.php.net to get a copy of this message | ||
Hi all,
On Tue, Dec 31, 2013 at 4:35 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> However, users can use them separately even if we add float support in GMP.
> For example, when arithmetic contains with GMP int or int, then GMP int
> should use
> GMP int only. When arithmetic contains GMP float, then GMP int/PHP float
> may be
> promoted to GMP float, like PHP int is promoted to GMP int.
>
If we do this, GMP numbers work like Ruby numbers.
[yohgaki@dev php-src]$ irb
2.0.0p247 :001 > 10 / 3
=> 3
2.0.0p247 :002 > 10.0 / 3
=> 3.3333333333333335
2.0.0p247 :003 >
[yohgaki@dev php-src]$ php -a
Interactive shell
php > $g = gmp_init('10');
php > echo $g / 3;
3
php > echo 10 / 3;
3.3333333333333
It may be better to stick with PHP way, since we will have both Ruby like
arithmetic and
PHP arithmetic.
Any comments?
--
Yasuo Ohgaki
yohgaki@ohgaki.net