Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100521 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 15177 invoked from network); 11 Sep 2017 15:36:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2017 15:36:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:60561] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6F/78-10715-09DA6B95 for ; Mon, 11 Sep 2017 11:36:49 -0400 Received: from [192.168.2.106] ([79.243.117.113]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MgbvP-1e3L102VGB-00Nz68 for ; Mon, 11 Sep 2017 17:36:45 +0200 To: "internals@lists.php.net" Message-ID: Date: Mon, 11 Sep 2017 17:36:45 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:Uuf8phfVrdg2cqM6KYUuMNg4Y1GSfS6aa24pFylsvQIAwgCGeLx 53/+ye9PvdROx/ILAAJpVmJML1ZgK48PC2a7uayCoqVkHykdV78lWeHmVZG1nA+sTltOj0P VNyLpSYr9yOwmFYekqJzkK+vnc3+y7DGMq+2ev39ybPx073GPC538J5oiiEZMVmQHMrjJti A0cIa/VqK1rirMY9d9g+Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:gtoyJaw3Udc=:Aqj+j3zBB+2YaDSQIlFor3 fPkXjhf34Q9akgPFMJiMyVkv+1YIbLUtQToe7ertMdqOWQOWzproKdbWmCzxDYV6+UuGojXP7 yi+n39Op2ZcR7qbIltr6O5wfTrk3yEFNpulNPJw6aeAMOJDVvp6s5YHrk4AfRHTLrjhirgzGc 6JNhRT2cich+92oEyQw920mEJx3lKYKRIj5vsE6jdRzwsqAesAC88AvJnQxSb0nbPClJc8tJb +MQ2Soyg6kkpGuGZtbcZOHqT5QQo2cDhJHSdBnBCwm1vsoqn822y60/gISCjLE+nhZy/wW1Zo 1Zs76XVjtzu6Lpvzox7Rdfbr0DNJm4xyBR+ANmOucTL7p1WSxPnkMEt9LVO/IBoKNfGqWEEw9 LVxZ8p4dg5j7w4DdIUQJtlN4YrayufYNdN6oN1JK91NrZCz2Lw+02trKmFOHyp872J7tRCZM2 b7KtThalf6luQNAIMc+SEYdp/uwwe8E0HnZVfWlhHClIlV4LEOMPPBtD+mXxfna15o5s4yg7D ISa2OYUG/grkLfvq9Xql/8J9k92D+S/BlUi9QIwvQ6oAdorkyrJSI1uaxHwBdxQskxJDnuG53 kEpoQA6Rygqm17OZRVZ/hIxJ/S74g6JooICbTKn/ZwHJFtJOZzihs7NUXBRYjaF+0oEmNmbOr MzMNwrynSkEEL2biU6r8C7t+sHO0vAVFvRMnDTJzgACzg5ZP7NaxTaLkyLIS4AzQIHeOnSlQU aB2ZC2WJVnkswpmsObZj52qMxQOrEYY09bSlH1lUSVqHNGYK1h+M7aqanChpjzQR++o8Eq0aG 8U5qwDDQ5LXJivGbDG9QD35WjugqU5fqhqeSjn03tIn3EbcI0c= Subject: BCMath and floats From: cmbecker69@gmx.de ("Christoph M. Becker") Hi everybody! All BCMath functions expects strings as operands (in the strict sense; do not confuse with arguments). This of course can result in unexpected behavior if floats are passed, namely: * floats may be converted to a string in scientific notation * floats may be converted with a decimal separator which is not a point Both result in BCMath treating such strings as '0'. Over the years there have been at least six bug reports regarding this issue: #10116, #42871, #47633, #55160, #66745, #66959. The last one has been reclassified as feature request, and I would like to address it. I already have proposed to introduce bcinit() which would take a string, int or float, and return a properly formatted string with the given or default scale, see . Nikita suggested to accept the arguments allowed by `bcinit()` for all functions in the first place. This would, however, raise the question which scale should be applied to floats. Before proceeding to an RFC (if necessary at all), I'm looking forward to hear your thoughts regarding this topic. -- Christoph M. Becker