Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:123050 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 079391A009C for <internals@lists.php.net>; Tue, 9 Apr 2024 00:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1712620926; bh=SBCZTn1gxPKzrNudY4dNeT7hmj9G0cCLEoRuZ/XxFfM=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=E7b8p697/KxLbPEr0el5QgU/KjmanZe2dFYOzdZqoimxjCY9CScMDHwyWy33e9rPp F0xhZ67AFKRZh91e3Gy2sttfldCyI7HRieOqezkLC5LRpzuS1hQ1LNTwSzjFv9x4GR Mpbnc/x46cdDclnyRkOtDnxwcdhTVQokI4Qa0PdiThqPfUQL181vHlrSNv4c7A+kNC fgoO2tI1e49t1fLW2oU24W2jpGqCwx8BQqNRH1e8xAkDKqzt1QDyZwKd1C0NQ1Hq+W aMi5hxBLqhNEOfrW1ZbZ28YJdpdW3xeUE22arUtyCzy82bieAYU0G6xi9gejacQh7Z y2RtKqLiuicsg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3B9B5180047 for <internals@lists.php.net>; Tue, 9 Apr 2024 00:02:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: <saki@sakiot.com> Received: from mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for <internals@lists.php.net>; Tue, 9 Apr 2024 00:02:03 +0000 (UTC) Received: from smtpclient.apple (unknown [117.55.37.250]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id EEDB8401EE; Tue, 9 Apr 2024 09:01:27 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1712620887; bh=SBCZTn1gxPKzrNudY4dNeT7hmj9G0cCLEoRuZ/XxFfM=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=RB4hgAbzIV2qzCCiBVd+uWHqWk6BFyTsqs/sLGbAwKA7M5Xu5/jyIj+X7BTLtGBAB 5n4R7J9MnSgTIgvdk7rnC90xvkQMsM1fR8C0vyWKqASEXxetlfFY7c//jxhseQO2zD PxxWmpNATbeomHdp59sWsV2rOsY3raeyydfglCOg= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: <mailto:internals+help@lists.php.net list-unsubscribe: <mailto:internals+unsubscribe@lists.php.net> list-post: <mailto:internals@lists.php.net> List-Id: internals.lists.php.net Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] Native decimal scalar support and object types in BcMath - do we want both? Date: Tue, 9 Apr 2024 09:01:15 +0900 Message-ID: <069A9DA0-927E-4486-BFFC-92543519F22F@sakiot.com> References: <CAMrTa2FeSTGE9rRdeMVzULkmn4C-LQ0GC8upDtEx1JEo6A0LFA@mail.gmail.com> Cc: "Rowan Tommins [IMSoP]" <imsop.php@rwec.co.uk>, internals@lists.php.net In-Reply-To: <CAMrTa2FeSTGE9rRdeMVzULkmn4C-LQ0GC8upDtEx1JEo6A0LFA@mail.gmail.com> To: Jordan LeDoux <jordan.ledoux@gmail.com> X-Mailer: iPhone Mail (21D61) From: saki@sakiot.com (Saki Takamachi) Hi Jordan, > To me, while being 100x to 1000x more performant at arithmetic is certainl= y reason enough on its own, the fact that MPFR (for example) has C implement= ations for more complex operations that can be utilized is the real selling p= oint. The ext-stats extension hasn't been maintained since 7.4. And trig is c= ritical for a lot of stats functions. A fairly common use of stats, even in a= pplications you might not expect it, is to generate a Gaussian Random Number= . That is, generate a random number where if you continued generating random= numbers from the same generator, they would form a normal distribution (a b= ell curve), so the random number is weighted according to the distribution. >=20 > The simplest way to do that is with the sin() and cos() functions (picking= a point on a circle). But a lot of really useful such mathematics are mainl= y provided by libraries that ALSO provide arbitrary precision. So for instan= ce, the Gamma Function is another very common function in statistics. To me,= implementing a bundled or core type that utilizes MPFR (or something simila= r) is as much about getting access to THESE mathematical functions as it is t= he arbitrary precision aspect. As you say, BCMath is really barebones and slower than other libraries. It w= ould be nice if there was a universal math extension that could handle all u= se cases, but unfortunately there isn't one today. The biggest problem is right there: there are several math functions, and th= ey have slightly different characteristics. If could combine all of these to create a new math function without sacrific= ing the benefits of each, do you think that would be possible? (It doesn't m= atter what libraries or technologies use internally.) To be honest, whenever I bring up the topic of BCMath on the mailing list, t= here are always references to speed and other libraries, so many people prob= ably want that, but unfortunately, we probably don't have a common idea abou= t the specifics. If what I write is off-topic and not appropriate for this thread, I can star= t a new thread. Regards. Saki=