Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:121284 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 48198 invoked from network); 12 Oct 2023 20:17:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 12 Oct 2023 20:17:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id BB076180212 for ; Thu, 12 Oct 2023 13:17:19 -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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 13:17:19 -0700 (PDT) Received: by mail-oi1-f172.google.com with SMTP id 5614622812f47-3af609c3e74so842733b6e.2 for ; Thu, 12 Oct 2023 13:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697141838; x=1697746638; 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=thJPooqCbCqnDNLy0ujr+NKHBtWEg9e6KuL+evZ35yI=; b=mCvbi+ifnaerFAntYsHD1D4TvO95pKLDMdmvKA1nokH40kqK6OXJEu7bVPIRxSKkhB jEZvvMk2IbGLhb/s++qYOjWoD6MLPlRRT7SjUyRI5uKNcQa4fMVE9XGvGX6fUtRS/jM0 /vYhToU1IbJMjRMNslz1AhqBiY1jyOBI0tjVm5YSjcAVFj6y+m70ItmSQMM0oKWrghO+ f6VLZrXaa6rHjgXe1qMtnaLWIKMp7d/JnrSOghMBLtmskPQktC2yvxhpidXk2Ao3fQ/u 0on6JbCGT4KGasWc7+Cs6+qFUml4fR3ahpWB5qcuFVjkmlLtUGjoQTW0kEXVy68zYGVU WzIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697141838; x=1697746638; 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=thJPooqCbCqnDNLy0ujr+NKHBtWEg9e6KuL+evZ35yI=; b=a7RlLgP0ouMzp4ymLP0GNpWrJj7oaF5T3VxVu00vk2v3OQqZMnP0aegEPtEjc/zQpF zZYd/VbHHLcBee7tz86vE6mtxkBKqYFnlzXNXwpNUL+o3Up88XcZe7sNTq2yKQ0SU7SZ R+u3/T1euEeWijywq5atJxQxv5IaGK+XMMNUchIoHaeBJJIjgG5byUEhc9rTtPoUqtJz OYSIgYvJfkTiThznipgbs2xKZwm4e6QDI1aqhBwN/NLI45+q3WMV89JZTLwmgtdU1j4I Zn17siXAPYnHWgWDGOO5MiWM2+uzt43OWVq9YUBIH22xe7DxtdndE32HUOJ8M+3h+iMb vS0w== X-Gm-Message-State: AOJu0YyV4cyl1qvB0bdpNeSu1zkzLUObIsvmKNg/UzcWEqrpMqUEWxFB XiWjZEBtXBxwURQOYLCSK2mD+3ftows2Z5VuH1O8DIyTjM08PQ== X-Google-Smtp-Source: AGHT+IHW3PMiPVmXW9b6GO1NnFpmZgZ2H9PDt2hgrtpGM+5hzH+iR+ex42ST5uJE/cQaFdJH1i8WKCFYHi7vOPGjukY= X-Received: by 2002:a54:4413:0:b0:3af:b2bd:daba with SMTP id k19-20020a544413000000b003afb2bddabamr25054572oiw.56.1697141838528; Thu, 12 Oct 2023 13:17:18 -0700 (PDT) MIME-Version: 1.0 References: <9812BAD1-5003-4E91-BB3B-00637B9687AC@sakiot.com> In-Reply-To: Date: Thu, 12 Oct 2023 22:16:41 +0200 Message-ID: To: Pierre Joye Cc: Jordan LeDoux , Saki Takamachi , PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] [Discussion] Adding bcround, bcfloor and bcceil to BCMath From: divinity76@gmail.com (Hans Henrik Bergan) been years since i checked, but last time i checked, BCMath supports floating point numbers, and PHP's GMP wrappers does not (this is not a limitation of GMP itself, but of PHP's GMP wrappers) - has the GMP api floating issues been fixed? a quick test suggest /no/: https://3v4l.org/FQaI4 On Thu, 12 Oct 2023 at 21:47, Pierre Joye wrote: > > 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.