Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121283 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 45630 invoked from network); 12 Oct 2023 19:47:31 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Oct 2023 19:47:31 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 4C27D1804BC for ; Thu, 12 Oct 2023 12:47:30 -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-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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:47:29 -0700 (PDT) Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-27d1373f631so1036430a91.1 for ; Thu, 12 Oct 2023 12:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697140048; x=1697744848; 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=L84i5RUwSIuxQ+UEKGO5HqtEdCfa16dDRyeaMJj3WfA=; b=fgl2/AV7R65XFuWxBLnXAGi0a8R4F/3SzjT+i2Iu/fZULSx7PNfUCDummDbwfdjV9/ ozPX21uxum61go4pFQ0sa9toHJ3Q37INVOdXD9Nt+xzWJp+egGHDReGVBlDZkNfqXcVL aHohevcrQl9JYfA00Z9yAdCz81xnbKS1yILHLsmsMHlx0nlW/kptju6T5Ri3FJLLbzqI zQsjYNXcIl6vCVxYJqsfE942cQ5cgz6k7tU5IVaBEmE1jv1jZy7UUagnr4yNcvAuxwW7 Oem6n47X3bQ0DJU33LaLgCdtX2UuRpBAkgzkYj9JPKjx9dZHkfNFELiokVRX/DrAP3fx Zppw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697140048; x=1697744848; 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=L84i5RUwSIuxQ+UEKGO5HqtEdCfa16dDRyeaMJj3WfA=; b=s8TfW6lIb/11wXH4rZ1YwoU+vKvAFw1mrf5SIdI+ZFnMMLFuRojijwjFdm1LIdQUVy gRYKl6uircGs59WBpvJBjgdsp2Xup4r52wPpj3L1Oo7xbbDbM6A3/ThTrM8T6LSdaHP+ Xks/HarO2Zx9xnxUgi1RoKcyXzSy7N4ye0ZTL+uis5EPhfTbKZVy7APGvSht3oOGcKNR z0a5zztoVggrV8GbRCTer8bxBvHpz/37OjuIy0QJ9jNukc8iWcqD7U1VT15+AG5umepe OrUiGUPKS7DcyVZV5VLK7HFUYKXI2gvlqNiwecE0aWzGWLvSrPttDCeRPhXKa8tnjQGW nBYQ== X-Gm-Message-State: AOJu0Yx+t3o1ngZsJ7nAijK3ovgO3wfQo8JL1WZ3+f4tuF+VenOAW8pn Eiv0c9J7cYll0ksIbhZQvbfKY9B6HLh51e9zkQs= X-Google-Smtp-Source: AGHT+IFqKlRvnCd2U6AVpkmgGlJt5HbStXyX+lwmVeA5vagyI3jNuOfPf5Z3N3U7hHAmjn3LYPiDka6WHqdQYlCtKZQ= X-Received: by 2002:a17:90b:2b4c:b0:27d:12e1:7e20 with SMTP id rr12-20020a17090b2b4c00b0027d12e17e20mr4345377pjb.12.1697140048410; Thu, 12 Oct 2023 12:47:28 -0700 (PDT) MIME-Version: 1.0 References: <9812BAD1-5003-4E91-BB3B-00637B9687AC@sakiot.com> In-Reply-To: Date: Fri, 13 Oct 2023 02:47:16 +0700 Message-ID: To: Jordan LeDoux Cc: Saki Takamachi , PHP internals Content-Type: multipart/alternative; boundary="000000000000b83bde06078a3537" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath From: pierre.php@gmail.com (Pierre Joye) --000000000000b83bde06078a3537 Content-Type: text/plain; charset="UTF-8" On Fri, Oct 13, 2023, 2:01 AM Jordan LeDoux wrote: > > > > 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. > it isn't really needed if not at the language level. scaled basic operations can be (relatively) easily optimized, with an order of magnitude faster than what bcmath does. however, the real challenge, imho, is the different uses. That's where rock solid implementation like mpfr could help, for non basic ops or modes. > But if you want an alternate implementation for arbitrary precision > decimals, it is certainly the place that someone should start. > for the few areas I needed it, I made my own with add/sub and mul/div with intrinsics. very little amount of codes and stable. I am not completely sure how to cover the different usages, scaled operations may be a good start and keeping bc math user land compatibility may not too hard. --000000000000b83bde06078a3537--