# PHP 7.2 and bcmod()

- Thread: https://externals.io/message/101239
- Original archive: https://news-web.php.net/php.internals/101239
- Started by Sebastian Bergmann on 2017-12-05T05:48:26+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #101239 — Sebastian Bergmann — 2017-12-05T05:48:26+00:00

URL: https://externals.io/message/101239#101239

http://git.php.net/?p=php-src.git;a=blob_plain;f=UPGRADING;hb=refs/heads/PHP-7.2
has this to say on `bcmod()`:

> The `bcmod()` function no longer truncates fractional numbers
> to integers. As such, its behavior now follows `fmod()` rather than
> the `%` operator. For example `bcmod('4', '3.5')` now returns '0.5'
> instead of '1'.

However, I cannot reproduce this:

$ php --version
PHP 7.2.0 (cli) (built: Nov 28 2017 20:05:12) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies

$ php -r 'var_dump(bcmod('4', '3.5'));'
string(1) "0"

Am I missing something?

Thanks!
Sebastian

---

## #101242 — Christoph M. Becker — 2017-12-05T12:19:36+00:00

URL: https://externals.io/message/101239#101242 · In reply to: #101239

> http://git.php.net/?p=php-src.git;a=blob_plain;f=UPGRADING;hb=refs/heads/PHP-7.2
> has this to say on `bcmod()`:
> 
> > […]
> 
> However, I cannot reproduce this:
> 
> $ php --version
> PHP 7.2.0 (cli) (built: Nov 28 2017 20:05:12) ( NTS )
> Copyright (c) 1997-2017 The PHP Group
> Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
> 
> $ php -r 'var_dump(bcmod('4', '3.5'));'
> string(1) "0"
> 
> Am I missing something?

As usual, the results depend on the scale factor (which is 0 by
default); see <https://3v4l.org/cvvoa>.

-- 
Christoph M. Becker

---

## #101244 — Sebastian Bergmann — 2017-12-05T13:34:58+00:00

URL: https://externals.io/message/101239#101244 · In reply to: #101242

Am 05.12.2017 um 13:19 schrieb Christoph M. Becker:
> > […]
> 
> As usual, the results depend on the scale factor (which is 0 by
> default); see <https://3v4l.org/cvvoa>.

Thank you.
