[RFC][DRAFT] GMP number as PHP number

php.internals

Yasuo Ohgaki

12 years ago
Hi all, There has been GMP number discussion and made draft RFC for it. Please comment so that I can add more to the RFC. Thank you.
-- Yasuo Ohgaki yohgaki@ohgaki.net

Robert Stoll

12 years ago
> -----Original Message----- > From: yohgaki@gmail.com [mailto:yohgaki@gmail.com] On Behalf Of Yasuo Ohgaki > Sent: Tuesday, December 31, 2013 12:44 AM > To: internals@lists.php.net > Subject: [PHP-DEV] [RFC][DRAFT] GMP number as PHP number > > Hi all, > > There has been GMP number discussion and made draft RFC for it. > Please comment so that I can add more to the RFC. > > Thank you. > > -- > Yasuo Ohgaki > yohgaki@ohgaki.net
Here the link to yasuo's RFC https://wiki.php.net/rfc/gmp_number

Sara Golemon

12 years ago
On float support in GMP extension: Big +1, and I'd be happy to implement it. On promotion/demotion between gmp/int and gmp/float: I suspect we can keep these as a single user-type, regardless of libgmp's internal representation of them, so it's a rather moot point. On overloading empty() to deal with objects that have a notion of emptiness: I'd like you to split that out into a separate rfc and a separate discussion. It's prthogonal to the floating point issue. ((But I would be tentatively for it)) On auto-parsing gmp objects into base scalars (such as for math function arguments): Again, this feels like it should be a separate rfc, particularly since it comes with a number of open issues around how we deal with overflows, loss of precision, and whether or now we attempt to magically rebox the result on return from the function (possible, but massively problematic). -Sara On Dec 30, 2013, at 16:00, "Robert Stoll" <php@tutteli.ch> wrote:

Yasuo Ohgaki

12 years ago
Hi Sara, On Tue, Dec 31, 2013 at 10:53 AM, Sara Golemon <php@golemon.com> wrote:
> On float support in GMP extension: Big +1, and I'd be happy to implement > it.
I appreciate if you implement it! I'll concentrate on encoding and session improvement :) Anyway, we already got new year. Happy new year to all of folks! Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Sara Golemon

12 years ago
On Tue, Dec 31, 2013 at 1:52 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> On Tue, Dec 31, 2013 at 10:53 AM, Sara Golemon <php@golemon.com> wrote: >> >> On float support in GMP extension: Big +1, and I'd be happy to implement >> it. > > I appreciate if you implement it! > I'll concentrate on encoding and session improvement :) >
I've pulled the GMP float proposal out of https://wiki.php.net/rfc/gmp_number and fleshed it out a bit as https://wiki.php.net/rfc/gmp-floating-point -Sara

Yasuo Ohgaki

12 years ago
Hi Sara, On Sat, Jan 4, 2014 at 4:07 PM, Sara Golemon <pollita@php.net> wrote:
> On Tue, Dec 31, 2013 at 1:52 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: > > On Tue, Dec 31, 2013 at 10:53 AM, Sara Golemon <php@golemon.com> wrote: > >> > >> On float support in GMP extension: Big +1, and I'd be happy to implement > >> it. > > > > I appreciate if you implement it! > > I'll concentrate on encoding and session improvement :) > > > I've pulled the GMP float proposal out of > https://wiki.php.net/rfc/gmp_number and fleshed it out a bit as > https://wiki.php.net/rfc/gmp-floating-point
I don't mind removing old RFC at all. I moved my RFC to "Withdrawn" section as reference. Thank you for your effort! Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Yasuo Ohgaki

9 years ago
Hi Sara, On Sat, Jan 4, 2014 at 4:07 PM, Sara Golemon <pollita@php.net> wrote:
> On Tue, Dec 31, 2013 at 1:52 PM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote: >> On Tue, Dec 31, 2013 at 10:53 AM, Sara Golemon <php@golemon.com> wrote: >>> >>> On float support in GMP extension: Big +1, and I'd be happy to implement >>> it. >> >> I appreciate if you implement it! >> I'll concentrate on encoding and session improvement :) >> > I've pulled the GMP float proposal out of > https://wiki.php.net/rfc/gmp_number and fleshed it out a bit as > https://wiki.php.net/rfc/gmp-floating-point
Any updates on this? Regards,
-- Yasuo Ohgaki yohgaki@ohgaki.net

Nikita Popov

12 years ago
On Tue, Dec 31, 2013 at 12:44 AM, Yasuo Ohgaki <yohgaki@ohgaki.net> wrote:
> Hi all, > > There has been GMP number discussion and made draft RFC for it. > Please comment so that I can add more to the RFC. > > Thank you. >
RE empty(): There is nothing special that needs to be done to implement this. To support empty() one simply has to implement the IS_BOOL cast. The reason I haven't implemented it in the first place is the common C++ programmer wisdom that you should never, ever overload the bool operator without using the safe bool idiom or an explicit operator (both not available in PHP, of course). But given that I already have GMP to string, double and int conversions implemented, it doesn't seem entirely unreasonable to also allow checking for GMP(0) via !$gmpNum as well. If the general opinion is that we want this behavior, I can add it. Nikita

Stas Malyshev

12 years ago
Hi!
> double and int conversions implemented, it doesn't seem entirely > unreasonable to also allow checking for GMP(0) via !$gmpNum as well. If the > general opinion is that we want this behavior, I can add it.
I think making (bool)GMP(0) be false and (bool)GMP(others) true may make sense. Though of course that would require people who check various factory methods by doing != false or such be extra careful to use !== or something like that. But that should be the case even now.
-- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227