Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124274 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 894D61A009C for ; Mon, 8 Jul 2024 03:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720411274; bh=jIe0JNvpRMyJq+xxfecmvFl7RRz+uPsGM+SjLxY09lg=; h=Subject:To:References:From:Date:In-Reply-To:From; b=LY25MRBHg125k3sXTRYyx7bUGseLAZxoDaSaR7me2KKk1lJlTOFjoiIUR7yCYEBpr PcsHPQ6jz0S+FXTMSo7KXDa09jadsJfGLv8XnfiumDw4bQlXCMFU/5Ks93bgvHgG27 bYu50M+wLtJ491z84QWedp/PcqdAUYzFkYS79fgfLKok6INftBhi58k4lH4vW8bFPn h5dwOtJz2AqAuVF6yKWdhBXYZHUv9dWiAzqKRyOgjlQVqTjAIT1dFomFW/0TRrL/2P msuoa4XbZRr3qVdN6hywJWs4iWaPG9z1BNWyUSh3pcavkqIitoxTsfplBsNmHbuh/G +m1dR+36ZrZAA== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id DAAC81805A9 for ; Mon, 8 Jul 2024 04:01:13 +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.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_05, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING, HTML_MESSAGE,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: Error (Cannot connect to unix socket '/var/run/clamav/clamd.ctl': connect: Connection refused) X-Envelope-From: Received: from fuchsia.ash.relay.mailchannels.net (fuchsia.ash.relay.mailchannels.net [23.83.222.64]) (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 ; Mon, 8 Jul 2024 04:01:13 +0000 (UTC) X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D5428C3672 for ; Mon, 8 Jul 2024 03:59:47 +0000 (UTC) Received: from nl1-ss105.a2hosting.com (unknown [127.0.0.6]) (Authenticated sender: a2hosting) by relay.mailchannels.net (Postfix) with ESMTPA id 350CFC362B for ; Mon, 8 Jul 2024 03:59:47 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1720411187; a=rsa-sha256; cv=none; b=gcXN8KzKnD6eqq3/HbTJO0G3TMX3coivdt/vmxXVO+CHMXbALfSHHwve5nGUmwRVrMh3mw AM7LkfHikw3W4Y+yxjTCaYd05M+BR3Zt13cRHGH8ymDFuwm24xNwLBBPPPSAKUuWX/ZBRG 6n3HUeGcWs08s7ChDdt7WGKxBe1Z71olbjsaVpalCqvzCgQtbPG3YDIeH7r7PuCxFzshGO HXwgvQNyf4MRIbde+V9H9eksc1G48nS4Cip0EUH1eY92XqTGCnpjNr0ay3qCUzuovLpgue /6xqhfgaHAcI73GnOO6DZXO9Mc9jp4iVc5zSuBYW/OJceSuLJVvPkXsYCpCNtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1720411187; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=bpY8RsXXTjCaSqsbKGXTc7At2M2jqo9ZNwPpNUxwzsw=; b=qPOkaqYAr6ApsrQN1IBGK8pvN/+PCVgRHNvNW+/Ts7vqI2UDJKwL5KR3KVidbKHOsXykbI SDcJwpUioD0dd+qTtsYG2eNB6iQ4WgfKugVq9VkJTTThrR9qgc0qnX2b9etFhi8+eDRIoD YtFMjOCqpLlbzfqhTJUbKfaT/8hhpgF8eHcVTtrarWUXkgbayrInZd5CltwvcgQ2PuSgRe 9E3II0naueIOmgafLvIadMoLiiyOoUoWYh7s7FeNF3eiVBEb14igO1HI77QkxvClX+Do9S Hb/VfLYSH/tT7hI43FNMO7ESuTiRxrOfvMlAftGFiY7yxWsFD1BbSjJ7peNkKA== ARC-Authentication-Results: i=1; rspamd-7c4f8cbcf8-4xt6l; auth=pass smtp.auth=a2hosting smtp.mailfrom=php-internals_nospam@adviesenzo.nl X-Sender-Id: a2hosting|x-authuser|juliette@adviesenzo.nl X-MC-Relay: Neutral X-MailChannels-SenderId: a2hosting|x-authuser|juliette@adviesenzo.nl X-MailChannels-Auth-Id: a2hosting X-Callous-Daffy: 1110b31426a975c2_1720411187745_305294200 X-MC-Loop-Signature: 1720411187745:1057545593 X-MC-Ingress-Time: 1720411187745 Received: from nl1-ss105.a2hosting.com (nl1-ss105.a2hosting.com [85.187.142.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.106.45.117 (trex/6.9.2); Mon, 08 Jul 2024 03:59:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=adviesenzo.nl; s=default; h=Content-Type:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Sender:Reply-To:Cc: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=bpY8RsXXTjCaSqsbKGXTc7At2M2jqo9ZNwPpNUxwzsw=; b=UNU5NUoCoY30XrrqRY0nXPamBJ FAw7FUcXX3PFKfwUnd1JyWB9+LirEaZI0gSdXvH4g89jfXPOSIGY6Q+oCgUZlWfKbMPm/F6NY0JMD CNYw9eMR/2AkFFDVN3DCAKNFw3B356u3b28tZ8YoboX7Tc2hzBjbopgjfqdfP0NRimNA=; Received: from mailnull by nl1-ss105.a2hosting.com with spam-scanner (Exim 4.97.1) (envelope-from ) id 1sQfXV-0000000HGPV-1KLb for internals@lists.php.net; Mon, 08 Jul 2024 05:59:45 +0200 X-ImunifyEmail-Filter-Info: QkFZRVNfSEFNIEFTTiBSQ1ZEX1RMU19BTEwgTUlEX1JIU19N QVRDSF9 GUk9NIEZST01fRVFfRU5WRlJPTSBNSU1FX1RSQUNFIE1JTUVfVU5LTk 9XTiBBUkNfTkEgUkNWRF9WSUFfU01UUF9BVVRIIEZST01fSEFTX0ROI FRPX0ROX05PTkUgUkNQVF9DT1VOVF9PTkUgSUVfVkxfUEJMX0FDQ09V TlRfMDEgVE9fTUFUQ0hfRU5WUkNQVF9BTEwgVkVSSUxPQ0tfQ0IgUkN WRF9DT1VOVF9PTkU= X-ImunifyEmail-Filter-Action: no action X-ImunifyEmail-Filter-Score: 2.05 X-ImunifyEmail-Filter-Version: 3.5.16/202406140020 Received: from [31.201.40.213] (port=49547 helo=[192.168.1.16]) by nl1-ss105.a2hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.97.1) (envelope-from ) id 1sQfXW-0000000HGP2-0oVr for internals@lists.php.net; Mon, 08 Jul 2024 05:59:45 +0200 Subject: Re: [PHP-DEV] [RFC] [Discussion] Allow int type argument to BCMath function To: internals@lists.php.net References: <668B4C78.2000808@adviesenzo.nl> <8FA0DE3B-2AF4-4110-9836-14E035DC8169@sakiot.com> Message-ID: <668B6428.9030705@adviesenzo.nl> Date: Mon, 8 Jul 2024 05:59:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 In-Reply-To: <8FA0DE3B-2AF4-4110-9836-14E035DC8169@sakiot.com> Content-Type: multipart/alternative; boundary="------------070504080007090506080607" X-AuthUser: juliette@adviesenzo.nl From: php-internals_nospam@adviesenzo.nl (Juliette Reinders Folmer) This is a multi-part message in MIME format. --------------070504080007090506080607 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 8-7-2024 5:18, Saki Takamachi wrote: > Hi Juliette, > >> Hi Saki, >> >> Just wondering: why `int|string` instead of `float|string` ? >> In my experience, floats are the more pertinent type for which to use the BCMath extension. >> >> Smile, >> Juliette > Since floating point numbers always contain a certain amount of error, I believe that they are not suitable as arguments for BCMath. Okay, so in that case, I must be missing something. > For example, 0.285 becomes 0.284999... in floating point. From the perspective of arbitrary precision math, there is no universally agreeable way to properly handle values ​​like this: there will always be people who want to treat it as 0.285, and people who want to treat it as 0.284999.... I honestly don't understand what you are saying here. If 0.285 is a string, then no type conversion would be needed to pass it to BCMath anyhow. Otherwise, 0.285 would be a floating point number already. If the type for BCMath would become `int|string`, in non-strict mode, there would be quite a significant change in behaviour for the BCMath functions as passing the _float_ 0.285 would previously result in the string "0.285" being passed to the BCMath function, but would now result in the integer 0 being passed. I think this BC-break will need to be called out as it is not mentioned in the RFC. I also think this BC-break should be enough reason not to accept the RFC. Smile, Juliette --------------070504080007090506080607 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 8-7-2024 5:18, Saki Takamachi wrote:
Hi Juliette,

Hi Saki,

Just wondering: why `int|string` instead of `float|string` ?
In my experience, floats are the more pertinent type for which to use the BCMath extension.

Smile,
Juliette
Since floating point numbers always contain a certain amount of error, I believe that they are not suitable as arguments for BCMath.
Okay, so in that case, I must be missing something.
For example, 0.285 becomes 0.284999... in floating point. From the perspective of arbitrary precision math, there is no universally agreeable way to properly handle values ​​like this: there will always be people who want to treat it as 0.285, and people who want to treat it as 0.284999....

I honestly don't understand what you are saying here.

If 0.285 is a string, then no type conversion would be needed to pass it to BCMath anyhow.
Otherwise, 0.285 would be a floating point number already.

If the type for BCMath would become `int|string`, in non-strict mode, there would be quite a significant change in behaviour for the BCMath functions as passing the _float_ 0.285 would previously result in the string "0.285" being passed to the BCMath function, but would now result in the integer 0 being passed.

I think this BC-break will need to be called out as it is not mentioned in the RFC.
I also think this BC-break should be enough reason not to accept the RFC.

Smile,
Juliette







--------------070504080007090506080607--