Jump to content

Mod operator Overflow suspected


pmtolk

Recommended Posts

B"H

 

I am using the math mod operator %

when I enter the following code

$result=1234567891 % 100000000

I get the correct result

34567891

but if I do it by 1 more digit

$result=12345678912 % 100000000

-39222976

which doesn't make any sense

 

12,345,678,912

12 billion should fit into a c type long which is was what I thought the default size of an integer is in php

What am I missing?

Thanks so much

Philip

 

 

Link to comment
https://forums.phpfreaks.com/topic/108916-mod-operator-overflow-suspected/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.