Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:69823 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36843 invoked from network); 24 Oct 2013 00:59:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Oct 2013 00:59:21 -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.217.182 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.217.182 mail-lb0-f182.google.com Received: from [209.85.217.182] ([209.85.217.182:34048] helo=mail-lb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/1B-10840-8E078625 for ; Wed, 23 Oct 2013 20:59:21 -0400 Received: by mail-lb0-f182.google.com with SMTP id p9so1547967lbv.41 for ; Wed, 23 Oct 2013 17:59:17 -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=EpvRp87ZBDOAG0StsCwXV+VEhmjxCNA4YWGHGYLUF+4=; b=qtYX2cNta+haG79rnVrvf+g3l/W+HGCbqRNYbqNIeGlLzTPi+aL+VAsPCErDFrItZw VV4VU8Ect8PftzNm99zcKd2Jd4nzPrgPkaBRfOxugF6aNQWrTOcNnymhswzeZTPYiGuq Id0ittNC/62xYK5tWRjlJ+6uEN00lLfSFZHLT/E/+X0jiFe7D6cY2pOcBvySO1BCN77e M+sGRW8lDY3KmpBAuZkk8UiPuoZEAVQ4Kxlv9rTmgk6yclhCiQhX6EU/kkYNFTuCFS13 BNkB9lfhER+9C0TlZ0kwWkwA6zUOwGrGcr+9d2cz7omL4iEvasGnLnzuxToEIU/4S5kf cl9w== X-Received: by 10.112.167.3 with SMTP id zk3mr235028lbb.23.1382576357538; Wed, 23 Oct 2013 17:59:17 -0700 (PDT) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.112.154.201 with HTTP; Wed, 23 Oct 2013 17:58:37 -0700 (PDT) Date: Thu, 24 Oct 2013 09:58:37 +0900 X-Google-Sender-Auth: dJsKtzEc_ZghBmaccmj8y_gYrAY Message-ID: To: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c264a4aa829704e972242d Subject: Bug #64760 var_export() does not use full precision for floating-point numbers From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a11c264a4aa829704e972242d Content-Type: text/plain; charset=UTF-8 Hi all, var_export() does not use full precision for floating-point numbers https://bugs.php.net/bug.php?id=64760 var_export() is supposed to export variables to be imported. Therefore, it should use "serialize_precision"(17) rather than "precision"(14). Following simple patch fixes the bug. https://github.com/yohgaki/php-src/commit/987ea9d9b406c75fafbfe0cdc334c81f0739f7dd Since this patch uses full precision like serialize, it will produce different outputs. For instance, ext/standard/tests/general_functions/var_export_basic3.diff 048+ -0.10000000000000001 049+ -0.10000000000000001 050+ string(20) "-0.10000000000000001" 048- -0.1 049- -0.1 050- string(4) "-0.1" 072+ 1.0000000000000001E-5 073+ 1.0000000000000001E-5 074+ string(21) "1.0000000000000001E-5" 072- 1.0E-5 073- 1.0E-5 074- string(6) "1.0E-5" 096+ 1.0000000000000001E-5 097+ 1.0000000000000001E-5 098+ string(21) "1.0000000000000001E-5" 096- 1.0E-5 097- 1.0E-5 098- string(6) "1.0E-5" 108+ 6.0000000000000006E-20 109+ 6.0000000000000006E-20 110+ string(22) "6.0000000000000006E-20" 108- 6.0E-20 109- 6.0E-20 110- string(7) "6.0E-20" 114+ 5.0000000000000001E+42 115+ 5.0000000000000001E+42 116+ string(22) "5.0000000000000001E+42" 114- 5.0E+42 115- 5.0E+42 116- string(7) "5.0E+42" 120+ 3.4000000000000001E-33 121+ 3.4000000000000001E-33 122+ string(22) "3.4000000000000001E-33" 120- 3.4E-33 121- 3.4E-33 122- string(7) "3.4E-33" I suppose it's safe to commit the fix to PHP 5.4 and PHP 5.5 branches. Any comments? -- Yasuo Ohgaki yohgaki@ohgaki.net --001a11c264a4aa829704e972242d--