100分!!!!求大数运算类和关于大素数的类! 100分!!!!求大数运算类和关于大素数的类! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的大数是怎么大?大到.net类库里面的类不能满足你??? 我是个初学者!我就想知道.net类库里面的哪些类是用于大数计算的? 好像.net没有类似Java里的大数类,int类型的范围最大的是Int64(或UInt64)。其它更大范围的需要自己用算法实现了。 大数运算的结构体写的太大了,贴不上来,就贴一部分 public struct BigInteger { private readonly short _sign; private readonly uint[] _data; private int _length; private static uint[] InternalAdd(uint[] x, int xl, uint[] y, int yl) { uint[] result = new uint[xl]; ulong temp = 0L; int index = 0; while (index < yl) { temp = temp + x[index] + y[index]; result[index] = (uint)temp; temp = temp >> 0x20; index++; } while ((index < xl) && (temp != 0L)) { temp += x[index]; result[index] = (uint)temp; temp = temp >> 0x20; index++; } if (temp == 0L) { while (index < xl) { result[index] = x[index]; index++; } return result; } result = resize(result, xl + 1); result[index] = (uint)temp; return result; } private static uint[] sub(uint[] x, int xl, uint[] y, int yl) { uint[] result = new uint[xl]; bool flag = false; int index = 0; while (index < yl) { uint currentX = x[index]; uint currentY = y[index]; if (flag) { if (currentX == 0) { currentX = uint.MaxValue; flag = true; } else { currentX--; flag = false; } } if (currentY > currentX) { flag = true; } result[index] = currentX - currentY; index++; } if (flag) { while (index < xl) { uint currentX = x[index]; result[index] = currentX - 1; if (currentX != 0) { index++; break; } index++; } } while (index < xl) { result[index] = x[index]; index++; } return result; } // 此处略去1000多行代码 } 自己写过一个加法.VS2003下写的,都没有LIST自己还实现的链表,用链表实现的.加减还是比较容易写,乘法稍微麻烦点 大数? 是你指可以存放很大数值的变量类型吗?decimal 是我知道最大的了....我是小菜鸟! 说的不好清见谅, 希望能够帮到你! decimal 数据类表示 128 位数据类型。同浮点型相比,decimal 类型具有更高的精度和更小的范围,这使它适合于财务和货币计算。decimal 类型的大致范围和精度如下表所示。类型 大致范围 精度 .NET Framework 类型 decimal ±1.0 × 10e−28 至 ±7.9 × 10e28 28 到 29 位有效位 System.Decimal 这还不够? 好消息是:.Net3.5 有一个不限位数的大数类,System.Numeric.BigInteger坏消息是:从Beta1 Release后,该类被暂时移走了,解释是需要更多的改进。见过很多大数的类,基本上都是用数组来存储。很多运算实现就是用我们熟知的排竖式的方法。这种文件很多,以下就有一个链接(我没有用过或认真看过):http://www.bouncycastle.org/csharp/BigInteger.cs 我的QQ;84242247 MSN:[email protected] 欢迎您的加入...欢迎团队朋友一起创业B2B交易网,需要:ASP,NET/PHP/JSP/SEO/美工/架构人员 希望有工作经验者一起创业,合作方式:技术入股主式.. 3,系统所需人员大致如下 : 一)专业Web网站美工 要求熟悉 DIV+CSS ,HTML ,XML ,尤其要熟悉JavaScript 和AJAX. 二)软件工程师 要求熟悉B/S开发,对面向对象的基本知识要求很熟悉,对常见的设计模式要有一定的认识,譬如,单例模式,工厂模式,门面模式。并能对ADO.NET有深刻的认识。同时要求熟悉数据库的基本知识,能写简单的存储过程(Procedures),触发器(Triggers),能熟悉常用的数据库系统日期处理函数,和字符串函数,并能自定义函数。同时要求熟悉VSS版本管理。 三)数据库工程师 要求对数据库的优化处理比较熟悉,能编写复杂的存储过程和触发器。能对海量数据做优化处理,并能很好的解决多用户操作造成的并发问题。 向数据库中更新信息问题 如何执行FlowLayoutPanel中的子控件的事件 C#个利用snmpSharpnet实现snmp网管系统(出现错误:由于系统缓冲区空间不足或列队已满,不能执行套接字上的操作)。 急,急,急~~~ word模板可以作为一段在word中循环利用吗? 在DropDownList 的Text 中├ 中的 如何让他显示退一格 这段代码用递归如何表示? 关于GIF和SWF的 WP 新手开发遇到个小问题 Xml反序列化一问 编程中常碰到的算法题,看看谁会 关于socket的简单问题
public struct BigInteger
{
private readonly short _sign;
private readonly uint[] _data;
private int _length; private static uint[] InternalAdd(uint[] x, int xl, uint[] y, int yl)
{
uint[] result = new uint[xl];
ulong temp = 0L;
int index = 0;
while (index < yl)
{
temp = temp + x[index] + y[index];
result[index] = (uint)temp;
temp = temp >> 0x20;
index++;
}
while ((index < xl) && (temp != 0L))
{
temp += x[index];
result[index] = (uint)temp;
temp = temp >> 0x20;
index++;
}
if (temp == 0L)
{
while (index < xl)
{
result[index] = x[index];
index++;
}
return result;
}
result = resize(result, xl + 1);
result[index] = (uint)temp;
return result;
} private static uint[] sub(uint[] x, int xl, uint[] y, int yl)
{
uint[] result = new uint[xl];
bool flag = false;
int index = 0;
while (index < yl)
{
uint currentX = x[index];
uint currentY = y[index];
if (flag)
{
if (currentX == 0)
{
currentX = uint.MaxValue;
flag = true;
}
else
{
currentX--;
flag = false;
}
}
if (currentY > currentX)
{
flag = true;
}
result[index] = currentX - currentY;
index++;
}
if (flag)
{
while (index < xl)
{
uint currentX = x[index];
result[index] = currentX - 1;
if (currentX != 0)
{
index++;
break;
}
index++;
}
}
while (index < xl)
{
result[index] = x[index];
index++;
}
return result;
}
// 此处略去1000多行代码
}
自己还实现的链表,用链表实现的.加减还是比较容易写,乘法稍微麻烦点
decimal ±1.0 × 10e−28 至 ±7.9 × 10e28 28 到 29 位有效位 System.Decimal 这还不够?
坏消息是:从Beta1 Release后,该类被暂时移走了,解释是需要更多的改进。见过很多大数的类,基本上都是用数组来存储。很多运算实现就是用我们熟知的排竖式的方法。这种文件很多,以下就有一个链接(我没有用过或认真看过):
http://www.bouncycastle.org/csharp/BigInteger.cs
3,系统所需人员大致如下 :
一)专业Web网站美工 要求熟悉 DIV+CSS ,HTML ,XML ,尤其要熟悉JavaScript 和AJAX. 二)软件工程师 要求熟悉B/S开发,对面向对象的基本知识要求很熟悉,对常见的设计模式要有一定的认识,譬如,单例模式,工厂模式,门面模式。并能对ADO.NET有深刻的认识。同时要求熟悉数据库的基本知识,能写简单的存储过程(Procedures),触发器(Triggers),能熟悉常用的数据库系统日期处理函数,和字符串函数,并能自定义函数。同时要求熟悉VSS版本管理。
三)数据库工程师 要求对数据库的优化处理比较熟悉,能编写复杂的存储过程和触发器。能对海量数据做优化处理,并能很好的解决多用户操作造成的并发问题。