Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88042 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 75155 invoked from network); 4 Sep 2015 00:41:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Sep 2015 00:41:47 -0000 Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.172 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.160.172 mail-yk0-f172.google.com Received: from [209.85.160.172] ([209.85.160.172:34619] helo=mail-yk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/32-60419-AC8E8E55 for ; Thu, 03 Sep 2015 20:41:46 -0400 Received: by ykdg206 with SMTP id g206so6555015ykd.1 for ; Thu, 03 Sep 2015 17:41:43 -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=Y9IRXEXg5PYSP93Pjo2vU/N0+l30ZZUGvl+sKu55h9A=; b=cVepWap4G5idS3M+VKSZdNERXnh1q9H3t3NY42MB7nKgXLewGkFrpip8oet9IrO9n/ JrC1c5Rnl2MwNP0cLsmRBHNrxX3xKU8laywRzBhm94Dxiz+K7xExAMw5Oui1GeMlPYXA XW2N8djOfBUDCdejUsu50YjAzUA+/WtrQy0uHt/NMw8zTqobQ/OwnfoD8bXXznltSELp iNcMdGAJ6aHbl3BNK3imjjqR7f8iHywmKUCWyGerZdzTb2/EjiZLpDqrYIdCYrsLpMgL 8LI8kpYMF9bkk+/wpeJafF5GIAII0pk2U55PtnaD+s2bwbcYgEZ+4K9Eus9JKU+cvNdU fHyw== X-Received: by 10.129.90.214 with SMTP id o205mr962790ywb.32.1441327303724; Thu, 03 Sep 2015 17:41:43 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.129.57.215 with HTTP; Thu, 3 Sep 2015 17:41:04 -0700 (PDT) Date: Fri, 4 Sep 2015 09:41:04 +0900 X-Google-Sender-Auth: x_VAhgCxaLMplYhCdotAzqpE2Lc Message-ID: To: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: [RFC] [DISCUSSION] More precise float value From: yohgaki@ohgaki.net (Yasuo Ohgaki) 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! Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net