C中是否有任何可靠的大整数实现? [英] Are there any solid large integer implementations in C?

查看:26
本文介绍了C中是否有任何可靠的大整数实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个项目,我需要以绝对精度和尽可能快的速度处理大整数(如 3^361).C 是我熟悉的最快的语言,所以我正在尝试用该语言编写我的解决方案.

I am working on a project where I need to crunch large integers (like 3^361) with absolute precision and as much speed as possible. C is the fastest language I am familiar with, so I am trying to code my solution in that language.

问题在于,除了 Python 的源代码之外,我还没有找到任何数据类型的良好实现来表示 C 中的无限整数.我需要时间来检查代码并确定我需要什么.

The problem is that I have not been able to find a good implementation of any data types for representing limitless integers in C other than Python's source code. It is taking me time to go through the code and determine what I need.

我宁愿使用其他人测试过的具有全套功能的代码(加法、减法、乘法、除法、调制、求幂、等式检查……甚至按位运算也很不错),而不是花费数周时间我什至开始让我自己的版本达到标准.虽然这将是一次很棒的学习经历,但这不是我的问题的重点,我更愿意进入我感兴趣的部分:)

I would much rather use someone else's tested code with a full set of functionality (addition, subtraction, multiplication, division, modulation, exponentiation, equality checking... even bitwise operation would be sweet) than spending the weeks it would take me to even begin to get my own version up to par. While it would be a great learning experience, it is not the focus of my problem, and I'd rather get to the part that interests me :)

推荐答案

Gnu MP 提供了一个 bignum 库.

Gnu MP provides a bignum library.

这篇关于C中是否有任何可靠的大整数实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆