php - PHP GMP:POW,exp 必须是浮点数
问题描述
尝试使用 PHP GMP 模块计算一些非常大的数字。到目前为止一切都很好,直到我不得不使用 GMP_POW,但 EXP 必须是浮点数,而不是数字或字符串。
适用于小数字的简单方法:
$result = pow(25323532325, 0.95); // Output: 7644482136.6877
但是使用 GMP:
$result = gmp_pow(25323532325, "0.95"); // Output: 1
我不那么聪明的想法:
$result = gmp_pow(gmp_init(25323532325), gmp_init(0.95)); // Error: Unable to convert variable to GMP - string is not an integer
解决方案
推荐阅读
- list - 列出序言中的交集
- elasticsearch - elasticsearch 通配符或正则表达式
- sorting - 排序地图分组按计数
- python - DoubleLinkedList 获取内存位置而不是节点值 - Python
- android - HTTPS 连接 - 如何管理密钥对
- r - 将多页pdf的每一页转换为R中单独的png文件
- ruby - Ruby:从陷阱上下文运行 irb?
- php - Laravel:尝试发送电子邮件时无法访问空属性
- css - ionic 4:改变离子含量背景不起作用
- node.js - 无法读取 /user_code/index.js 处未定义的属性“来自”