Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 PHP,我想做数百万次 2^n 求幂,但到目前为止,在 PHP 打印 INF 之前我只达到了 n^1023。
有任何想法吗?
正如 Greg 所说,BC Math很好,但如果您真的需要效率,请尝试使用GMP。
您可以使用BC 数学函数:
$num = bcpow(2, 1000000); // Takes a few seconds to run!