MySql 的 GMP 函数

发布于 2024-12-17 13:09:53 字数 208 浏览 3 评论 0原文

我有一个 php 应用程序,它使用 GMP 库中的按位函数 - gmp_and、gmp_or、gmp_xor。我需要使用 gmp,因为我的位范围超出了 64 位整数限制。

我想将此处理交给 mysql 服务器,但似乎 mysql 没有任何等效的功能。有没有合适的扩展可用?我还可以使用哪些其他方法来处理 mysql 中的这些任意精度整数?

感谢一百万 (1x10E6)。

I have a php application that uses the bitwise functions from the GMP library - gmp_and, gmp_or, gmp_xor. I need to use gmp because my bit range exceeds the 64 bit integer limit.

I would like to hand this processing off to the mysql server however it seems that mysql doesn't have any equivalent functions. Are there any suitable extensions available? What other approaches could I use to process these arbitrary precision integers in mysql?

Thanks a million (1x10E6).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

ˇ宁静的妩媚 2024-12-24 13:09:53

MySQL 中没有合适的扩展来执行 GMP。您可以将数字存储为大字符串,并使用 PHP GMP 包装器来处理它们。显然,这并不像本机数据类型那么有效,但根据您的用例,它可能完全没问题。

如果您没有依赖 MySQL,Postgres 确实有一个 GMP 扩展,它非常灵活: http:// pgmp.projects.postgresql.org/

There is not a suitable extension to do GMP within MySQL. You could store your numbers as large strings, and use the PHP GMP wrapper to process them. Obviously, this isn't quite as efficient as a native datatype, but depending on your use case, it might be perfectly fine.

If you're not tied to MySQL, Postgres does have an extension for GMP, which is pretty slick: http://pgmp.projects.postgresql.org/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文