Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121282 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42276 invoked from network); 12 Oct 2023 19:01:08 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Oct 2023 19:01:08 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id EE67F180041 for ; Thu, 12 Oct 2023 12:01:06 -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: Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) (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 ; Thu, 12 Oct 2023 12:01:06 -0700 (PDT) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-1e10507a4d6so862664fac.1 for ; Thu, 12 Oct 2023 12:01:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697137265; x=1697742065; 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=XKzeCKLw4man7iFE9ZoF9BRVmLRHptrKdeTDTD4slXA=; b=A1L4CuJN84smqfyDS0+CTVKWC9UKVFGNs8Yd+YUJ/JwCyVnNlyWa4Af0MR4PQbEhGK bPbhWLt9sSjDONwHjPQvmOBHSp8IDkf/SQgNH3deArm/ip31BdZGjT1ohh7Bw/jle3P4 3vKpoiZZVLC7VqDbH2Qr2L+Rrua5cFV0HTG2QT4T7C6s0ZRTea+jMqanWUeMQcyeazHf 431hHOsBLDWJFh0g+NgrHIPc/i803jJZKewN4OdJwzvnDVFOINY8TDfW1LzEbYO7Nov9 IJnfixpLlebt9ULp5lAT5gp/Ob2wPCGvpk29eVulI/VGLJvRGVK4Ygh45LUE7AIU48Wl rvIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697137265; x=1697742065; 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=XKzeCKLw4man7iFE9ZoF9BRVmLRHptrKdeTDTD4slXA=; b=XaFe/lPXl7/yTsUMJCg8EoHvSXXZpcX+izoWHKN9c4N6p62M/rUmWl9HQapRsBXvaG DDLm26US4IPW6xmUkJkwCUvgsxDthIOKx7SDlN4sSNJYculy6HCF60OAjq3kjUa2DkG4 wB8n57d7QGwP7HSsKiZGqL1bGSy4RKCviCWvaItkxkvYqoX1bTVPX+koY9KQQ981U3T0 UoFf9Eo4BQHhLGbgvS8JjzrTTT6oJ1+fUt2v/UXGqWebEcdaQyoxNAATKfd3NJXR3G/V uVkqjQca+YxooCioJliLsOIH4Qz4dpI6RbRUF+4Rta5dcjbbTPGJzfMc/R7YUCBQ5NMH +RXA== X-Gm-Message-State: AOJu0YxvBKFQYglh2flp4s2feQX4VyaUdpGJfuh6UlE/ivyb+wb0gioG V7F+9zbL5EYJo0RhK58cNJK0SotN2+EoQ0eCOOM= X-Google-Smtp-Source: AGHT+IGpJNMXIBu3h4W0REZpuCOdT1ZcVHeaSXyTqa9/U8QuA6JiLgutskkYXfw8FQYF5bqFEC2x/LErhqhnFxfx1A0= X-Received: by 2002:a05:6870:64ac:b0:1e9:9f06:96e0 with SMTP id cz44-20020a05687064ac00b001e99f0696e0mr5739385oab.23.1697137265553; Thu, 12 Oct 2023 12:01:05 -0700 (PDT) MIME-Version: 1.0 References: <9812BAD1-5003-4E91-BB3B-00637B9687AC@sakiot.com> In-Reply-To: Date: Thu, 12 Oct 2023 12:00:54 -0700 Message-ID: To: Pierre Joye Cc: Saki Takamachi , PHP internals Content-Type: multipart/alternative; boundary="000000000000d9369f0607898f66" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath From: jordan.ledoux@gmail.com (Jordan LeDoux) --000000000000d9369f0607898f66 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Oct 12, 2023 at 11:32=E2=80=AFAM Pierre Joye = wrote: > Hi Jordan > > On Fri, Oct 13, 2023, 1:24 AM Jordan LeDoux > wrote: > >> >> >> On Thu, Oct 5, 2023 at 5:27=E2=80=AFAM Saki Takamachi = wrote: >> >>> 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 onl= y >>> 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() >> or cos(). It is *technically* possible, but not at all reasonable. >> > > it is the reason I mentioned mpfr, > https://www.mpfr.org/mpfr-current/mpfr.html#Miscellaneous-Functions > > the challenge I noticed in a couple of threads recently is the mixup of > radically different usages, like financial numbers with basic ops (+/- > eventually *//) and others. > > they cannot use the same tools, most of the times. However there are libs > with different types or mode of operations, which could be a better fit > than what we do now. > > It is not an easy research and priorities need to be clear. > > BCMath is one of the worst and slowest implementations of arbitrary >> precision decimals. >> > > what I was trying to express :) > > > best , > I believe MPFR is what is used by ext-decimal. The only thing that makes ext-decimal a somewhat difficult replacement for BCMath is that one of them uses precision and the other uses scale. (Total accurate digits versus total significant digits.) Fermat has implementations for both BCMath and ext-decimal, while also using GMP. It is much more difficult to control the number of accurate digits in ext-decimal than in BCMath, but ext-decimal is literally hundreds of times faster. I think, however, that Rudi (the author of ext-decimal) was against including ext-decimal in core. But if you want an alternate implementation for arbitrary precision decimals, it is certainly the place that someone should start. Jordan --000000000000d9369f0607898f66--