Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105453 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68107 invoked from network); 26 Apr 2019 09:56:17 -0000 Received: from unknown (HELO mail-qt1-f195.google.com) (209.85.160.195) by pb1.pair.com with SMTP; 26 Apr 2019 09:56:17 -0000 Received: by mail-qt1-f195.google.com with SMTP id h16so2986291qtk.6 for ; Thu, 25 Apr 2019 23:57:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=J1Z39W94sNAPBXCOuG2Fn1kIL+JGDrgBLo1Qz7Xv9u4=; b=mgP/Wra+W9xj+d7LBhO3MgV6qtPjE9mVi7+tsaeRqAIOIf1MbNBMBPjgZS5N1StiOY cFwmn9rbtV8QiKOcQ9dZBoTUrXvfSNsYIa8KQ+3L6965Vfyc4l1b7LutS/UUDEzHEEKW ufjVOn4j9TX8gK11ttmlsPxsy0ZT+kjw9sEWqzaQXypmiLb3msgNcuYMdwP8fXgLXNFM OBHTgDMiGrZriHKmr3IQBAZHKFIBRuAaQiTHTc48q4w6Cp2Gt4WvlZYFOJKlgDVtyDzM qnAeuLMyQg8PinsEoTj/PdkJzvctXEr+OqHC5GQ4kLtWkCdLv5LZImQfJIJQ05M68D5N ctxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=J1Z39W94sNAPBXCOuG2Fn1kIL+JGDrgBLo1Qz7Xv9u4=; b=q+UHMK6/FQ9eZUjfLDNTK0BDwArKYnAzbUI9I6fCCYQsub3RI6iW9ZyoeVP/eYObcX x5pe0FrGUJv3CdRDyI2Tqm9a/JBrIIFUMJrEKBt64Tve+ajBvOTHdXyy6DpeJnd1hnG3 J+s5ILhgNCyCltGhz1Zv4pDgnxxm6IfzsNbZeNUcvqnDbfyCioufGey0YxWqywUd++PX fZNE+AfXlOs2/SWl4/uk6pI641mixEChV/d7MdqZgrn28YESZPSNAG52WvZYyytxZ7S1 y4msn0UK9O5dQPdwaJE/cFn8JIoQqievcgbi6aoydaqm9AAL2HHbLdtXMzcgs4zC8J2U /feQ== X-Gm-Message-State: APjAAAUTOTwghYeqQ3cngn/PcaqYs9IzFjtcBM0BjCM3eFLofk3L+mfR vNZb99FsG9ufoomkGxRq1jfKvrVYNnbLxmm4yw== X-Google-Smtp-Source: APXvYqy0qe11D7KJkO85oVgqZGUegnPmC/ZAcB7peJ706Vbg/A0MwmJF40uz0gZINgiRINouPW1yPBgK49/WQfuq9lU= X-Received: by 2002:a0c:d905:: with SMTP id p5mr7880683qvj.53.1556261842249; Thu, 25 Apr 2019 23:57:22 -0700 (PDT) MIME-Version: 1.0 References: <5c633ed8.1c69fb81.143ab.ad85@mx.google.com> In-Reply-To: Date: Fri, 26 Apr 2019 09:57:11 +0300 Message-ID: To: Benjamin Morel Cc: "Legale.legale" , Ben Ramsey , PHP Internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Make bcmath functions more strict From: vladyslavstartsev@gmail.com (Vladyslav Startsev) On Thu, Apr 25, 2019 at 12:35 PM Benjamin Morel wrote: > > Hi Vladyslav, > > I just checked your code snippet, here are my 2 cents: > > - bcmath should definitely trigger an error when encountering a malformed string like '17 .123', silently converting it to zero is indeed the worth thing to do; > - I don't think that there's much value in having it handle exponential notation, you can use userland libraries such as brick/math for this; > - I *really* don't think that it should depend on the current locale, like PHP sometimes does with numbers; there has been some discussion just a few months ago to actually stop making float-to-string conversion depend on locale: > https://externals.io/message/103638 > > Ben > > On Thu, 25 Apr 2019 at 11:02, Vladyslav Startsev wrote: >> >> Any other ideas on that one? >> >> I'll wait for one more week and make RFC then >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> Hello Benjamin! Thank you for the reply. Can you please explain your point of view a little bit? Things that I don't understand > - bcmath should definitely trigger an error when encountering a malformed string like '17 .123', silently converting it to zero is indeed the worth thing to do; I don't really understand it, I must be strict, converting to zero will lead to wrong calculations. > - I don't think that there's much value in having it handle exponential notation, you can use userland libraries such as brick/math for this; Definitely yes, that was my point > - I *really* don't think that it should depend on the current locale, like PHP sometimes does with numbers; there has been some discussion just a few months ago to actually stop making float-to-string conversion depend on locale: Sure thing, I was just trying to describe all the cases that we have