Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87426 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18019 invoked from network); 31 Jul 2015 07:45:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jul 2015 07:45:35 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.173 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.173 mail-yk0-f173.google.com Received: from [209.85.160.173] ([209.85.160.173:35284] helo=mail-yk0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F6/60-15448-D972BB55 for ; Fri, 31 Jul 2015 03:45:34 -0400 Received: by ykdu72 with SMTP id u72so53322402ykd.2 for ; Fri, 31 Jul 2015 00:45:31 -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:from:date:message-id :subject:to:cc:content-type; bh=xzFFlpgurM2E87RgTCs8mu1sxZpidEzyWMM2L6fMx0s=; b=DZzVMR1GXrmvSk2k81klt/FSwmKivGHlYZvBmErK4ND+mtec9hAnqK93FMv/UwkKuK KT2mUoa3M58gGTS9jO6s2wi6nnYwyfTFNkqeKs0yypHIzH4bCxM+L1RiSzsg1H0Pw3eg 4YRtFqf3fhtl+88f7SGiMYnM/4YjY4HQxtHcdlhYltwItezT5KuCYKC97fYqakkS/V8u 7KHovmdc0fvCRhqsNy1a1tO8L6f6FaSxCW4APgpOHfBX8xYZLoY6M8RBJolYiq+rxmq7 iNUDO8bJbIjtgFztBCg4DfG/UewUd6Vp6AgRy4VVrfKLE5weDUdkjWy/I458pXtb4MSD 2Jxw== X-Received: by 10.13.233.133 with SMTP id s127mr1744177ywe.154.1438328731156; Fri, 31 Jul 2015 00:45:31 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.40.77 with HTTP; Fri, 31 Jul 2015 00:44:51 -0700 (PDT) In-Reply-To: References: Date: Fri, 31 Jul 2015 16:44:51 +0900 X-Google-Sender-Auth: Rz6_PcrBUCKvCwooTVXh6LTvDLg Message-ID: To: Nikita Popov Cc: Jakub Zelenka , Anthony Ferrara , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=94eb2c0736e41745b8051c27011f Subject: Re: [PHP-DEV] json_decode/encode should return full precision values by default From: yohgaki@ohgaki.net (Yasuo Ohgaki) --94eb2c0736e41745b8051c27011f Content-Type: text/plain; charset=UTF-8 Hi Nikita, On Thu, Jul 30, 2015 at 6:06 PM, Nikita Popov wrote: > On Thu, Jul 30, 2015 at 1:25 AM, Yasuo Ohgaki wrote: > >> Hi all, >> >> On Thu, Jul 30, 2015 at 7:44 AM, Yasuo Ohgaki wrote: >> >>> On Thu, Jul 30, 2015 at 1:13 AM, Nikita Popov >>> 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. >> > > Nice idea about using a special serialize_precision value for this. This > allows to keep BC for those that have tests for particular serialize output > or similar things. > > I would suggest to default serialize_precision to -1 in PHP 7 -- if people > want the previous behavior they can still have it, but I think -1 is the > more reasonable default as it matches what one would naturally expect. > > I don't see the need for having a separate setting for JSON. Having a > dozen different float precision settings will not help anyone. > Thank you for your feedback. I agree it's better if PHP7 uses 0 mode by default. I'll update the RFC. I have things to do on this weekend. I'll try to write patch this weekend hopefully. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --94eb2c0736e41745b8051c27011f--