Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124273 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 BC7E61A009C for ; Mon, 8 Jul 2024 03:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1720408797; bh=+Rd/Qp9s+HWg8sFGcA/4dXBM9dCOzLCsw+qTFST77pk=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=f7Zv0RlrkJdVxAaCymmDNjD9SoSIvPoru9WPQ6gTBrUQScez1zeVBBxnAV8Rgwcy1 atSnAoTPyHKUNL/JtidVP02CN7VgOAED2FHupxI5iKDAJ92S/NkQs+thXYmV9ONPm+ mcJMsIrjsSbo0Y6tSmARdzhZp0FudXI9PgHRGDe4tf4cOQVuOE2KP5+08IXaBKjWRX hQYTyZSUy4gdQSwVK6DMaOt0NXw/7Zhlwd67dsnokJ18jLgEb6o4sigIAcXAJ14n5P U8v2mJ+sItiG5c3FRrYiyf8OjNtYw76wcAFIfwwYv3WYPFNPgsLBKlkhgrCuRZyBL+ Rgko7VjpjF4AQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E822A18005D for ; Mon, 8 Jul 2024 03:19:56 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS,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 mail.sakiot.com (mail.sakiot.com [160.16.227.216]) (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 03:19:56 +0000 (UTC) Received: from smtpclient.apple (104.70.239.49.rev.vmobile.jp [49.239.70.104]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.sakiot.com (Postfix) with ESMTPSA id D3A3C4011B; Mon, 8 Jul 2024 12:18:28 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1720408708; bh=+Rd/Qp9s+HWg8sFGcA/4dXBM9dCOzLCsw+qTFST77pk=; h=From:Subject:Date:References:Cc:In-Reply-To:To:From; b=UzE8Pbyp+1z84GGgcTQPTA+0TyD/g3DN2KuR7qnFcJuuPV1TzT7P74ugj2E+pW0/a ZBULhJ7/jOJMwryOxeWnM1c9v2WBnmcxHa2aHEvUcxu6h2CKMNz0wH3xPYAcd57Ou3 h7egPUkpe85O8bzNhNlzGBRfGnhUz6eOFG9Kv+8Y= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net Mime-Version: 1.0 (1.0) Subject: Re: [PHP-DEV] [RFC] [Discussion] Allow int type argument to BCMath function Date: Mon, 8 Jul 2024 12:18:15 +0900 Message-ID: <8FA0DE3B-2AF4-4110-9836-14E035DC8169@sakiot.com> References: <668B4C78.2000808@adviesenzo.nl> Cc: internals@lists.php.net In-Reply-To: <668B4C78.2000808@adviesenzo.nl> To: Juliette Reinders Folmer X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) Hi Juliette, > Hi Saki, >=20 > Just wondering: why `int|string` instead of `float|string` ? > In my experience, floats are the more pertinent type for which to use the B= CMath extension. >=20 > Smile, > Juliette Since floating point numbers always contain a certain amount of error, I bel= ieve that they are not suitable as arguments for BCMath. For example, 0.285 becomes 0.284999... in floating point. =46rom the perspec= tive of arbitrary precision math, there is no universally agreeable way to p= roperly handle values =E2=80=8B=E2=80=8Blike this: there will always be peop= le who want to treat it as 0.285, and people who want to treat it as 0.28499= 9.... Therefore, I believe BCMath should not accept floats as arguments. Regards, Saki=