Re: [RFC] Floating Point support in GMP extension
| From: | Yasuo Ohgaki | Date: | Sat, 04 Jan 2014 20:38:49 +0000 |
| Subject: | Re: [RFC] Floating Point support in GMP extension | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71002@lists.php.net to get a copy of this message | ||
Hi Sara,
On Sat, Jan 4, 2014 at 4:09 PM, Sara Golemon <pollita@php.net> wrote:
> https://wiki.php.net/rfc/gmp-floating-point
>
> This extracts just the gmp floating point sub-proposal from @yohgaki's
> "GMP number as PHP number" RFC (
> https://wiki.php.net/rfc/gmp_number )
>
> No implementation yet as I'd really like input on what the API should look
> like.
My only concern is GMP float and int conversion.
I prefer to have result
10 / 3 = 3
and
10.0 / 3 = 3.33333333333333333333333(to GMP precision)
I prefer to have INT result for "INT op INT" and float result for "FLOAT op
INT". Huge integer arithmetic has it's own usage and converting int to
float automatically is not nice, since it breaks goodies of GMP int. I hope
everyone prefer this behavior.
GMP float and int may be separated completely. i.e. raise error for mixed
usage and require explicit cast. I don't mind this implementation, too.
It's less convenient, but it should work.
In short, I prefer to have automatic conversion by operands, not by
operator.
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net