Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87334 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 60801 invoked from network); 28 Jul 2015 00:40:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jul 2015 00:40:23 -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.179 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.179 mail-yk0-f179.google.com Received: from [209.85.160.179] ([209.85.160.179:35588] helo=mail-yk0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/92-33169-47FC6B55 for ; Mon, 27 Jul 2015 20:40:21 -0400 Received: by ykdu72 with SMTP id u72so83372642ykd.2 for ; Mon, 27 Jul 2015 17:40:18 -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=i3kDQe2HpGSiQIoeNI1XVdNx69BcZJEvM8gkj1xO404=; b=xNYTCMAdmKv1I4xsU6PjqzSz89BH59sxp2zLop2wKveaMIOYIv5HyufpHRpXvgCbNy 8CkXuW8HWR4lKW73/e6YgcUW8emJBxQVthAzpWPJwCMxjCl8H4tRfH8HMAlQUG04RsjY aQgLxCwVgZ3xnJ2dQRsJIchx/P1UdalS3Fwb41UE4m6OEc4DPQlImGNKx2aUOj0vLnA4 AH2CNBL8zXje/AZZ6jZp7nQZSEfwjAQKgPOY7O9H3RR5RObZ9bmCk2seABi4sqpgmdpg 7PQC2UN6FJryHJtFeokQt4gDRmiaJM/hkBMbEgQdP132hISrkMF60odUg0MW8s0NrZk2 7V6A== X-Received: by 10.170.207.195 with SMTP id y186mr33485613yke.2.1438044017961; Mon, 27 Jul 2015 17:40:17 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.40.77 with HTTP; Mon, 27 Jul 2015 17:39:38 -0700 (PDT) In-Reply-To: <55B6CE07.1020600@gmail.com> References: <55B6CE07.1020600@gmail.com> Date: Tue, 28 Jul 2015 09:39:38 +0900 X-Google-Sender-Auth: Yig6rZfn1HG3al_9njmYFK884K0 Message-ID: To: Stanislav Malyshev Cc: Anthony Ferrara , Jakub Zelenka , "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1139e11cdcb503051be4b666 Subject: Re: [PHP-DEV] json_decode/encode should return full precision values by default From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1139e11cdcb503051be4b666 Content-Type: text/plain; charset=UTF-8 Hi all, On Tue, Jul 28, 2015 at 9:34 AM, Stanislav Malyshev wrote: > > > > We can write > > > > $old = ini_set('precision', 17); > > json_encode($var); > > ini_set('precision', $old); > > > > everywhere to workaround this problem. > > If we're talking about encoding, that's what precision setting is - it > says how much we want to preserve in decimal encoding of float numbers. > Decoding, of course, should use whatever data available and not > truncate, but I understand that is already happening? > > > Question is "Is this the way it should be?". > > I don't see why not. That's exactly what precision setting is for, as > far as I can see. JSON is var exporter/importer like serialize/var_export. Both of serialize/var_export uses PG(serialize_precision), what's the point of _lose_ / _destroy_ original values while PHP could keep more precise values than now? Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1139e11cdcb503051be4b666--