Newsgroups: php.internals
Path: news.php.net
Xref: news.php.net php.internals:121279
Return-Path: <jordan.ledoux@gmail.com>
Delivered-To: mailing list internals@lists.php.net
Received: (qmail 36540 invoked from network); 12 Oct 2023 18:26:51 -0000
Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5)
  by pb1.pair.com with SMTP; 12 Oct 2023 18:26:51 -0000
Received: from php-smtp4.php.net (localhost [127.0.0.1])
	by php-smtp4.php.net (Postfix) with ESMTP id 0BA45180212
	for <internals@lists.php.net>; Thu, 12 Oct 2023 11:26:51 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net
X-Spam-Level: 
X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,
	RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,
	SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no
	version=3.4.2
X-Spam-ASN: AS15169 209.85.128.0/17
X-Spam-Virus: No
X-Envelope-From: <jordan.ledoux@gmail.com>
Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (P-256) 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>; Thu, 12 Oct 2023 11:26:50 -0700 (PDT)
Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-58d261807e8so944905a12.2
        for <internals@lists.php.net>; Thu, 12 Oct 2023 11:26:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20230601; t=1697135210; x=1697740010; darn=lists.php.net;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:from:to:cc:subject:date:message-id:reply-to;
        bh=/9054HEYp9wcbaZ4h5S1Qd9X6pLpZrOOkGqezbY20hw=;
        b=UZRg3jAlQOMX3buftj7omjem7SEBaD9fHglvkpXOA1hSDIm0aSclr6I5uZnCjcNZaQ
         6onlpmSXo6ORLrrpk9PBbIeI95w7yUdTZNeAJ822cxcxj/6pkUu/mvcPYcxIJgPNoREM
         o51t01qH4owZAtYK0yDH8BLCoX0fxDxbRhc4rL839dlmFeLUe+8GJqAvXuXhRMe992Jb
         TWOmVP+RhkQearVNkKHHGWIDMr2iNSi1rmBQDP3gDu9r+6ZDK60giz5pbnEQX6dGeJGE
         9gicIQ2ZNO6g35ffYecdnhY+IS3Ag+Pm2pq+I4Ua+CaYR1SvxU01u1J9/RaVPwEAuaFC
         plHw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20230601; t=1697135210; x=1697740010;
        h=cc:to:subject:message-id:date:from:in-reply-to:references
         :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id
         :reply-to;
        bh=/9054HEYp9wcbaZ4h5S1Qd9X6pLpZrOOkGqezbY20hw=;
        b=XVH15S2al1qoDzB9u2ec8+hFa4bSGQNMd7UbNqbktTR+BMb3xzvOXq5ybG8Dog7WlG
         S5MxpHKQRqPti83osyI34c6m71CBuH8Sm2OOte2Cdgdoagp9AUxTpXkZaPAb6qXL6gIj
         +q6BtVOa6jFRhY/Yj43kKQCjhMo0K3HB6RqM5UmBnaRK2doh7GmFwACFAAT/mKjOsnUz
         DFjL708yinNw6Y58ag8c/Q9nB281r+NxDO/opMyNWpeJP+FF1F3+sN+6WN7kfq44znlX
         c5bFtgzVzFNVkxIXzpN3ecnptec6W1cnEH81F2+gbuMF/+gB57fnSO1xBaQTeKB1fJzQ
         4GXQ==
X-Gm-Message-State: AOJu0YyqW/LyyK0689JLMnkml2ufZ3B1fT4UV9rTAmfRAiv48dCc6pff
	rms1Lwv3znx+DAgH3G90Fv+YNh/ZfALsnmjYT/E=
X-Google-Smtp-Source: AGHT+IEQ1eJk6hJR1kypXGO82hbTxO4F/QGHZvggctBte/nmyD8ZI782+qJ6vhl4wHiYhPztM35qZKnfK+hbflQ5SKU=
X-Received: by 2002:a05:6a20:8422:b0:140:730b:4b3f with SMTP id
 c34-20020a056a20842200b00140730b4b3fmr32007799pzd.1.1697135209839; Thu, 12
 Oct 2023 11:26:49 -0700 (PDT)
MIME-Version: 1.0
References: <CAEZPtU6PT7yOhVZfGQ1Vh3soKH0tkXh86v0GiNJo79ZMiuO4XQ@mail.gmail.com>
 <9812BAD1-5003-4E91-BB3B-00637B9687AC@sakiot.com> <CAMrTa2H553O1CesPU95ma-HYnejWkMgZf-QOVvCxs=NHMOAc+g@mail.gmail.com>
In-Reply-To: <CAMrTa2H553O1CesPU95ma-HYnejWkMgZf-QOVvCxs=NHMOAc+g@mail.gmail.com>
Date: Thu, 12 Oct 2023 11:26:39 -0700
Message-ID: <CAMrTa2E9XvPrRqOx3wr_6tU+UBDp3yebKw8-ob-NTzHmHRXTYQ@mail.gmail.com>
To: Saki Takamachi <saki@sakiot.com>
Cc: Pierre Joye <pierre.php@gmail.com>, PHP internals <internals@lists.php.net>
Content-Type: multipart/alternative; boundary="00000000000051813106078915b8"
Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding bcround, bcfloor and bcceil
 to BCMath
From: jordan.ledoux@gmail.com (Jordan LeDoux)

--00000000000051813106078915b8
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Oct 12, 2023 at 11:24=E2=80=AFAM Jordan LeDoux <jordan.ledoux@gmail=
.com>
wrote:

>
>
> On Thu, Oct 5, 2023 at 5:27=E2=80=AFAM Saki Takamachi <saki@sakiot.com> w=
rote:
>
>> Hi, Pierre
>>
>> In fact, I predict that many use cases will be covered by GMP.
>>
>> Still, I think that there may be cases where calculation functions like
>> mainframe BCD are required, such as when calculating money.
>>
>> I am unable to decide whether it is correct to deprecate BCMath and only
>> use GMP.
>>
>> I'd like to hear other people's opinions as well.
>>
>> Regards.
>>
>> Saki
>>
>
> GMP cannot be used in any reasonable way to implement things like sin() o=
r
> cos(). It is *technically* possible, but not at all reasonable. Now, PHP
> doesn't natively support trig functions for anything other than normal
> floats, but things like that are exactly the extended capability that my
> PHP math library adds. This is required for most statistics, which now HA=
VE
> to be done in PHP itself since the ext-stats extension hasn't been update=
d
> since... I think 7.1?
>
> BCMath is one of the worst and slowest implementations of arbitrary
> precision decimals. It absolutely should be replaced. I have explored
> creating a new extension to do just this in fact for the express purpose =
of
> deprecating and replacing the bundled BCMath. But GMP, as it is implement=
ed
> currently, is not a replacement at all.
>
> Jordan
>

Take a look at the ext-decimal extension if you are interested in replacing
BCMath. It honestly is almost a drop-in replacement.

Jordan

--00000000000051813106078915b8--