Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87294 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 45342 invoked from network); 25 Jul 2015 22:02:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Jul 2015 22:02:40 -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.181 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.181 mail-yk0-f181.google.com Received: from [209.85.160.181] ([209.85.160.181:34141] helo=mail-yk0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/31-28932-E7704B55 for ; Sat, 25 Jul 2015 18:02:38 -0400 Received: by ykax123 with SMTP id x123so44238611yka.1 for ; Sat, 25 Jul 2015 15:02:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to:content-type; bh=cfsIBJCjxAwqt/NNgVbI3oF862RwBie3OPI6+KTHWfY=; b=mLZgAmFhqY2GHnKfUhoS4eiJtKcQ+57AsTLCd3F0EM2jhFMaXQJEnCazYQ00lTEtlm DlNPT+08lptN7olJah/akSlmqHa7EVDKLeBRiXbXQVg5BqQoiL/Qk6sErlPYJJByiusw c4SO77/cAADL653WvpYSXWP+C+v/PIe5f/W8TSMb4IMNIorLLYcIpq9ijdjb4yURTSXS XPiKi+F9E9bvTp98fgfIFV8MyWMV7ZywQuMfpzoAWFa0aV3QElDv27JpfcLR4jxUMUai mz4n45p3F0+OCHuqMOv6x+dTGVUytOibAocYZcydMChwKoCw49j42Nb1uPSm1aHmLqoR ehIw== X-Received: by 10.13.233.133 with SMTP id s127mr22971377ywe.154.1437861755225; Sat, 25 Jul 2015 15:02:35 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.40.77 with HTTP; Sat, 25 Jul 2015 15:01:55 -0700 (PDT) Date: Sun, 26 Jul 2015 07:01:55 +0900 X-Google-Sender-Auth: FVqur8FBSoFUDQPTTjUhnRrWlUM Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=94eb2c0736e4280ddc051bba4737 Subject: json_decode/encode should return full precision values by default From: yohgaki@ohgaki.net (Yasuo Ohgaki) --94eb2c0736e4280ddc051bba4737 Content-Type: text/plain; charset=UTF-8 Hi all, I had to work with Google Map API and need to handle values precisely. Fortunately, it seems values are IEEE double, but I get rounded float values by default. For example, object(stdClass)#5 (2) { ["results"]=> array(2) { [0]=> object(stdClass)#1 (3) { ["elevation"]=> float(1608.6379394531) ["location"]=> object(stdClass)#2 (2) { ["lat"]=> float(39.7391536) ["lng"]=> float(-104.9847034) } ["resolution"]=> float(4.7719759941101) } [1]=> object(stdClass)#3 (3) { ["elevation"]=> float(-50.789035797119) ["location"]=> object(stdClass)#4 (2) { ["lat"]=> float(36.455556) ["lng"]=> float(-116.866667) } ["resolution"]=> float(19.08790397644) } } ["status"]=> string(2) "OK" } json_decode()/json_encode() must be able to handle precise IEEE double value by _default_. serialize() is changed to use max precision. json_decode/encode should do the same at least. I think this change should be provided as bug fix. Any comments? -- Yasuo Ohgaki yohgaki@ohgaki.net --94eb2c0736e4280ddc051bba4737--