Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88522 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1009 invoked from network); 27 Sep 2015 17:29:27 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2015 17:29:27 -0000 Authentication-Results: pb1.pair.com smtp.mail=jakub.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jakub.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.172 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.172 mail-ig0-f172.google.com Received: from [209.85.213.172] ([209.85.213.172:34346] helo=mail-ig0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 80/C9-06395-47728065 for ; Sun, 27 Sep 2015 13:29:25 -0400 Received: by igcpb10 with SMTP id pb10so41451663igc.1 for ; Sun, 27 Sep 2015 10:29:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=Qx2MNR0lEpk0pqp+5hN+0oDC6B3M0QVLG7ldCsUZhpY=; b=TpbUt2wSYs9MJJjhHuf++uEr3N5/2vP5bPAGMPa4Z64rBhBkYlbiYKMXKbKfBfIRia WwsXDWoOhgXI1BSQoKGU1yDn2opD1I8mqWUT1hoaTjjjk7Qmo8ZmZDhROsDIhhvm41I3 y5PGiVggRKoXSzSzQKonaCMrWBrkGdti2Kfzi3aDSWUBVfLJon6P7nbqVgQSOyvY3MKi H3LZBtDmLEu7WO/5aipx5U/jT02fqwlZauo6NSM09+rM5h/lzQm8ULQznutTbOcDmxtC G0fJJx81ByJoi+w9wHdH8L4Qj7bbwNbiPg9Ha7eL9DNFlDNLA45FxbbO/FSiQAnPHdTW KmYw== MIME-Version: 1.0 X-Received: by 10.50.122.10 with SMTP id lo10mr12639609igb.76.1443374961262; Sun, 27 Sep 2015 10:29:21 -0700 (PDT) Sender: jakub.php@gmail.com Received: by 10.107.145.69 with HTTP; Sun, 27 Sep 2015 10:29:21 -0700 (PDT) In-Reply-To: <004701d0f892$05fdb0d0$11f91270$@belski.net> References: <023701d0f4a4$a0da4f60$e28eee20$@belski.net> <004701d0f892$05fdb0d0$11f91270$@belski.net> Date: Sun, 27 Sep 2015 18:29:21 +0100 X-Google-Sender-Auth: 8LRs2JnxbN1cj8SGjaKiiYqCDeQ Message-ID: To: Anatol Belski Cc: Yasuo Ohgaki , Kalle Sommer Nielsen , Ferenc Kovacs , PHP internals list Content-Type: multipart/alternative; boundary=089e01538362d8072d0520bdebdb Subject: Re: [PHP-DEV] Re: [RFC] [DISCUSSION] More precise float value From: bukka@php.net (Jakub Zelenka) --089e01538362d8072d0520bdebdb Content-Type: text/plain; charset=UTF-8 Hi Anatol, On Sat, Sep 26, 2015 at 8:31 PM, Anatol Belski 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 --089e01538362d8072d0520bdebdb--