Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93820 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11337 invoked from network); 5 Jun 2016 19:01:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Jun 2016 19:01:16 -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.41 as permitted sender) X-PHP-List-Original-Sender: jakub.php@gmail.com X-Host-Fingerprint: 209.85.213.41 mail-vk0-f41.google.com Received: from [209.85.213.41] ([209.85.213.41:35331] helo=mail-vk0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/10-09778-BF674575 for ; Sun, 05 Jun 2016 15:01:15 -0400 Received: by mail-vk0-f41.google.com with SMTP id d127so174826287vkh.2 for ; Sun, 05 Jun 2016 12:01:15 -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; bh=F9M035wxfIUESvAAjNBHE33JLG3fUsy5A1IN6AY66+U=; b=LJDZORrUUohnSUXVFgJzeMFmkC6j3Bv/jidKkubyRbO2UNTA2X/Or/tPt+Alg1OXcE 3QxC+2fN2SWxO6vG43PijzyD7xo9lodFRpgdaYTltOLmCysTN5ZWUltzOeIqeLo2/CJ4 iRQ3Df/3R8V05lWyU9VfFT5A+MQv5d0dOfyzsecO9JJNHNfIUxioF9jyDBP9HiWTDEq+ xRS29ufp18MJqp4PUWgfFQYAQYhQVSnPlJ21X+tfP0guFsGfT945fGHpvlJQlU5yfPgT ESHHRE2B83723ouI5nY4JB4xRGJoqobaGCHnRM0y8Y4zc282gnTCnJeuBQMQHzVLncjZ ralQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=F9M035wxfIUESvAAjNBHE33JLG3fUsy5A1IN6AY66+U=; b=SR2m5R7ef72ePvbOXh5X2G/xEhyqxJ591bB8HMRSlCI932id1AzpLsqIjivLXbWKBK ePu8sReYQXmvifPgDJxSTe8s3D2OpwtekssZths+t3HQq/Frva5uUjsr2+v8szSHl/07 XkId+5UoAIcxOKLqFKs1DKgLY8CMvgvKwVzFDLwTF5nxBDdOmKoPdrfqh24rb8PrdUK3 49It4YpJYKgySJ8Is9BSHGbVIP9j3TSMKTgH3lm2qhXmDRRy6lcnUrgchTOUYs5l+3WM TCLhruLPgpNy6M1JVn/ugzwY0XWasQZHSaQ29zwRkJwRa3Ev9Q10qH54FUArwraA4Yc1 JtKg== X-Gm-Message-State: ALyK8tKnIwTUd4xfWBdUMyUmthkHF8tDPTYjuqKPGi1t2Dzd3RCMNzg6uRXdi+WWBBQJT6FAIpj2HR9TTVO9IQ== X-Received: by 10.176.2.241 with SMTP id 104mr5906887uah.151.1465153272735; Sun, 05 Jun 2016 12:01:12 -0700 (PDT) MIME-Version: 1.0 Sender: jakub.php@gmail.com Received: by 10.31.172.65 with HTTP; Sun, 5 Jun 2016 12:01:12 -0700 (PDT) In-Reply-To: References: Date: Sun, 5 Jun 2016 20:01:12 +0100 X-Google-Sender-Auth: geiYA3sU9HpLd5PeoZ1O1T9eG3Q Message-ID: To: Nikita Popov Cc: "internals@lists.php.net" , Yasuo Ohgaki Content-Type: multipart/alternative; boundary=001a113cd4725cee1605348c9449 Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] More precise float value From: bukka@php.net (Jakub Zelenka) --001a113cd4725cee1605348c9449 Content-Type: text/plain; charset=UTF-8 On Mon, May 30, 2016 at 8:01 PM, Jakub Zelenka wrote: > On Mon, May 30, 2016 at 7:28 PM, Nikita Popov > wrote: > >> On Mon, May 30, 2016 at 6:34 PM, Jakub Zelenka wrote: >> >>> On Fri, Sep 4, 2015 at 1:41 AM, Yasuo Ohgaki wrote: >>> >>> > Hi all, >>> > >>> > IEEE 754 double cannot express exact float values. That said, >>> > float values expressed by json/serialize/var_export/echo/print >>> > are not precise enough in many cases. >>> > >>> > Issues: >>> > - json_encode() uses EG(precision)=14 that truncates float values. >>> > echo()/print() >>> > does this as well. >>> > - large EG(precision)/PG(serialize_precision) prints meaningless >>> values. >>> > >>> > This RFC proposes zend_dtoa()'s 0 mode support which rounds float value >>> > to nearest value. >>> > >>> > https://wiki.php.net/rfc/precise_float_value >>> > https://github.com/php/php-src/pull/1455 >>> > >>> > This change is simple enough for PHP 7.0. IMO. >>> > Comments/suggestions are appreciated! >>> > >>> > >>> Hi, >>> >>> After asking Yasuo, I'm putting forward this RFC to have more precise >>> float >>> to string decoding at least in PHP 7.1. I cleaned the RFC up a little bit >>> and it's targeting just 7.1. >>> >>> It has been some time since this was announced so I will keep it open >>> for a >>> week or two and then plan to start vote. >>> >> >> Thanks for taking over this proposal! >> >> I've already mentioned this on the PR when this was originally proposed, >> but bringing it up here as well: >> >> This proposal adds a new json.precision setting. Why? I've been told that >> this is more flexible, which is fair enough, but imho we should have very >> strong reasons for introducing new ini settings. Reasons that go beyond "it >> might be useful to someone ... maybe?" So what's the particular use-case >> here? Where is it necessary to export inaccurate floating point numbers in >> JSON? And should such a use-case indeed exist, why is this a global setting >> rather than an option of json_encode? Furthermore, note that even without >> this new ini option, you always have the option of temporarily changing >> serialize_precision for a json_encode call, if you *really* need it. >> >> Please also take a look at this comment on the implementation: >> https://github.com/php/php-src/pull/1455#discussion_r53933480 >> >> > To be honest I have been thinking again about it before posting it. I > thought that it might be good to have at least a voting option or keep it > there for discussion but I don't really mind to drop it and just use just > serialize_precision by default. I know that it was me who suggested > json.precision initialy but it wasn't probably the best idea and it might > be a bit confusing for users. If no one thinks that it's useful and we > should have a vote about it, I will remove it in the next couple of days. > > I have updated the RFC and dropped the json.precision part. Instead of that, there will be a voting option only whether to use serialize_precision for json_encode. If there are no other issues, I would like to open voting sometimes next week. Cheers Jakub --001a113cd4725cee1605348c9449--