转换任意一大批立足256

转换任意一大批立足256

本文介绍了转换任意一大批立足256的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些非常大的长度可高达50位。我正在那作为字符串输入。不过,我需要在其上执行操作。所以,我需要将它们转换为一个适当的基础,让说,256。

I have a number of very large length may be upto 50 digits. I am taking that as string input. However, I need to perform operations on it. So, I need to convert them to a proper base, lets say, 256.

什么将是最好的算法来做到这一点?

What will be the best algorithm to do so?

推荐答案

多项precision运算(又名的)是一个很难受,和良好的算法是不直观的(有书的事情)。

Multiple-precision arithmetic (a.k.a. bignums) is a difficult subject, and the good algorithms are non intuitive (there are books about that).

有几种库处理大数,例如像在 GMP库(还有其他的)。其中大部分需要从一些硬件指令的利润(例如,使用随身携带补充)与汇编code精心调校小块。因此,他们的表现比你会是怎样能够code在几个月更好。

There exist several libraries handling bignums, like e.g. the GMP library (and there are other ones). And most of them take profit from some hardware instructions (e.g. add with carry) with carefully tuned small chunks of assembler code. So they perform better than what you would be able to code in a couple of months.

我强烈建议使用现有的BIGNUM库。编写您自己会带你多年的工作中,如果你希望它是有竞争力的。

I strongly recommend using existing bignum libraries. Writing your own would take you years of work, if you want it to be competitive.

又见答案这个问题

这篇关于转换任意一大批立足256的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:23