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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Tue Jul 15 16:01:33 2025 UTC