php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63023 modulus problem
Submitted: 2012-09-06 20:10 UTC Modified: 2012-09-06 21:22 UTC
From: steven dot edward dot m at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.3.16 OS: windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: steven dot edward dot m at gmail dot com
New email:
PHP Version: OS:

 

 [2012-09-06 20:10 UTC] steven dot edward dot m at gmail dot com
Description:
------------
Modulus return wrong result when:
2166896650%1000000000 = -1280706462
what was the problem, is there any way to get the correct answer?


Expected result:
----------------
expected result was: 166896650


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-06 21:22 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2012-09-06 21:22 UTC] rasmus@php.net
You are overflowing your 32-bit int limit on Windows. Move to 64-bit Linux or use 
bcmod(). eg.

php > echo bcmod('2166896650','1000000000');
166896650
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 01:01:32 2025 UTC