On Wed, Jul 29, 2015 at 5:25 PM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:

> Hi all,
>
> On Thu, Jul 30, 2015 at 7:44 AM, Yasuo Ohgaki <yohg...@ohgaki.net> wrote:
>
> > On Thu, Jul 30, 2015 at 1:13 AM, Nikita Popov <nikita....@gmail.com>
> > wrote:
> >
> >> Instead of continuing to use serialize_precision, which will produce
> >> unnecessarily long outputs for many values, why don't we just switch to
> >> using the 0 mode of zend_dtoa, i.e. to return the shortest output that
> is
> >> still accurate if interpreted in round-to-nearest. I think this is what
> >> everybody else is using when they convert floating point numbers to
> >> strings. I guess we may not be able to change normal floating point
> >> printing to use this, but this seems like the best mode for anything
> using
> >> serialize_precision now and everything that should be using it (like
> JSON,
> >> and queries, etc).
> >
> >
> > I prefer your proposal!
> > Your proposal is a lot better than now.
> > Anyone has opinion for this?
> >
> > I'm writing the RFC and I would like to make this the first option. i.e.
> > serialize_precision=0 uses "zend_dtoa 0 mode" for all data exchange
> > functions (json/serialize/var_exrport. Anyone care about WDDX/XML_RPC?)
> >
>
> I wrote draft RFC.
>
> https://wiki.php.net/rfc/precise_float_value
>
> Please comment. I would like to start RFC discussion shortly.
> Thank you.
>

My thought would be why not -1 to make it obvious it has special meaning?
When I see precision=0 I tend to think that means my numbers will be
returned as ints no matter what (there is zero fractional precision)
whereas this takes a valid value for precision and gives it special
meaning. I fully support your end game, but giving a valid value a special
meaning I do not like.


>
> --
> Yasuo Ohgaki
> yohg...@ohgaki.net
>

Reply via email to