1
2
不准确的模数结果是因为60143590000000928(~2^52)超出了int的界限,所以php将其解释为浮点。这意味着您有一个32位系统(PHP数据类型大小因体系结构而异)。如果你需要对大数字进行数学运算,你可以使用类似的库 GMP . 例如。:
确保将大量数字作为字符串传递给gmp。 |
2
0
如果它被识别为字符串,可以尝试使用
老实说,在执行字符串拆分时,您可能会将$total数组强制转换为int:
表示数字的字符串也可以转换成(float),这取决于您使用的PHP版本(double)。 |
3
0
无法复制此问题:
当然是预期的行为… |
4
0
我添加了这个作为答案,因为在评论中没有足够的空间:
如果这是所描述的算法的实现
here
我真的认为模检验
例如,考虑前15位数字如下:
我想你必须核对最后一个数字是否与
|
minus one · 空条件和空合并运算符*与*纯布尔表示法 6 年前 |
zaozaoer · >>java中带负字节值的and>>>运算符 6 年前 |
Ganesh Thampi · 使用位的奇偶程序 6 年前 |
FredMan · Rust中的<-符号是什么? 6 年前 |
user9578589 · Java条件数组 6 年前 |
Francisco José Letterio · 无法理解指针操作 6 年前 |
Danny · 如何在r中键入grep中的运算符 6 年前 |
David Rector · 什么是?=操作员在Swift中做什么? 6 年前 |
Gian · “/”操作符在Lua中提供什么功能? 6 年前 |