Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124552 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 7A68C1A00B7 for ; Tue, 23 Jul 2024 03:10:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1721704350; bh=abZ9epTGCYjzGGc2nNyuXcXr7jy4KWy9/gtBf2fHjfQ=; h=From:Subject:Date:References:In-Reply-To:To:From; b=B/a+SYm4+QFi4To7VP27Aqo6WCx1aPtZL/yqt6XOyrPikcfy0I3lMiqwfErKJlevX vaCMSDWCjUTk9u1t4FIeeP1AXSs6AL+ScUZJ3tBV/lCdY+TSF6P3TthcbvaAX/ucWT CTUy8kLEYPnKyKbYRtbId0JpQKLYJ6qX8Ebe7lcE9Gb2mTR+BcncWRipgVpRnVDYX7 fCpkIUGb4lg9kqACmerbpvQgTSLY2qvngSSMQLW3XWvewugm+f3L9DNaVFiYUtrxV5 gUgcZoBv2J+OMtkKCZowt6kNTYGSucGjatcxXKyEslSg21n439f9drqon1wK1M+BgK BIq7g+xoG4tlg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 23033180039 for ; Tue, 23 Jul 2024 03:12:30 +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 autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No 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 ; Tue, 23 Jul 2024 03:12:29 +0000 (UTC) Received: from smtpclient.apple (unknown [117.55.37.250]) (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 44AE3401CD for ; Tue, 23 Jul 2024 12:10:55 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sakiot.com; s=default; t=1721704255; bh=abZ9epTGCYjzGGc2nNyuXcXr7jy4KWy9/gtBf2fHjfQ=; h=From:Subject:Date:References:In-Reply-To:To:From; b=VHq2YYAnCH35KYIkXGLseWxkH8R1/9Fl3OBn2SFBsAQOun6ASHKoXzoaGMOdj7ODF +dxfxCgI7fD56pAvqz9UtRTWcYlPQFLERpVC6a1hrXhSKr3LyMIQqpPCokbfbiOj8u ySZ/k6/8uBtS6JIttF+BcKZ4wfz5O1Q7Vi8oIEh4= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (1.0) Subject: [PHP-DEV] Re: bcmod() behavior is different from what I expected Date: Tue, 23 Jul 2024 12:10:42 +0900 Message-ID: References: <0F3CC580-7A03-4212-A117-715D5B1AA2BD@sakiot.com> In-Reply-To: <0F3CC580-7A03-4212-A117-715D5B1AA2BD@sakiot.com> To: PHP Internals X-Mailer: iPhone Mail (21F90) From: saki@sakiot.com (Saki Takamachi) > =EF=BB=BFHi internals, >=20 > I noticed that `bcmod()` behavior is a little different from what I expect= ed. >=20 > First, look at the following code for `bcdiv()`: > ``` > bcdiv('99', '100', 2); // '0.99' > ``` >=20 > So what should the following code be? > ``` > bcmod('99', '100', 2); > ``` >=20 > The result is `'99.00'`. > I was expecting `'0.00'` for this. I thought that if gave `bcdiv()` and `b= cmod()` the exact same arguments, their results would not contradict each ot= her. >=20 > To me this is unexpected behaviour, how do you think? >=20 > Regards, >=20 > Saki However, considering the behavior of `fdiv()` and `fmod()`, the current beha= vior of `bcmod()`may be correct and my thinking may be wrong... Saki=