Hi Anatol,

On Sat, Sep 26, 2015 at 8:31 PM, Anatol Belski <anatol....@belski.net>
wrote:

> Hi Yasuo,
>
> > > Thanks for the ping. IMHO this is the stuff for 7.1. I actually saw the
> > discussions previously, but was rather thinking you was targeting 7.1 as
> that was
> > already the time of the feature freeze.
> >
> > No problem. I'll update so that 0 mode is for 7.1.
> > JSON's is better to use larger precision. So this change is targeted to
> 5.6 and 7.0.
> >
> > Let me know if you have comments on this.
> >
> Thanks for retargeting the RFC.
>
> > > BTW I also had a comment there in the PR about
> https://github.com/php/php-
> > src/pull/1455/files#diff-c84859666ff690a113d55ef1899d8bf4R149 - so if
> mode
> > 0 ignores ndigits, why set it to 17 (or anything else). Seems like an
> unnecessary
> > action, but snprintf is used quite frequently. But just as a notice on
> the side.
> >
> > "-1" which is invalid precision is used to indicate 0 mode.
> > 0 mode is supposed to use max precision for double (it seems many
> > implementations use 16, but PHP uses 17), when 0 mode is used, it uses
> 17 as
> > precision always.
> >
> Exactly, so my question was - why it still needs to do "if (mode == 0)
> ndigit = 17;" in snprintf at the place I've linked? It won't have any
> effect as zend_dtoa will ignore it :)
>

As I said in the PR some time ago, it's not used by dtoa for mode 0 but
it's still used by php_gcvt for checking if exponential or decimal notation
should be used. See

https://github.com/php/php-src/blob/250938e2d35fc54161a18167b7901c5e3b574371/main/snprintf.c#L163

Cheers

Jakub

Reply via email to