JKBigInteger 0.0.1

JKBigInteger 0.0.1

测试已经测试
语言语言 CC 语言
许可 MIT 许可
发布最后发布2015年2月

Janis Kirsteins 维护。



关于 JKBigInteger

JKBigInteger 是一个小型库,用于在 Objective-C 中轻松处理大整数。JKBigInteger 是围绕 LibTomMath C 库的 Objective-C 封装。它灵感来源于 Java 的 BigInteger。

示例

JKBigInteger *int1 = [[JKBigInteger alloc] initWithString:@"123"];

NSLog(@"%@ + %@ = %@", int1, int1, [int1 add:int1]);

JKBigInteger *int2 = [[JKBigInteger alloc] initWithString:@"10000001234567890123"];
JKBigInteger *int3 = [[JKBigInteger alloc] initWithString:@"123"];

NSLog(@"%@ - %@ = %@", int2, int3, [int2 subtract:int3]);

JKBigInteger *int4 = [[JKBigInteger alloc] initWithString:@"11111111111111111111"];

NSLog(@"%@ * %@ = %@", int4, int4, [int4 multiply:int4]);

JKBigInteger *int5 = [[JKBigInteger alloc] initWithString:@"10000001234567890123123123123"];
JKBigInteger *int6 = [[JKBigInteger alloc] initWithString:@"123"];

NSLog(@"%@ / %@ = %@", int5, int6, [int5 divide:int6]);

unsigned int numBytesInt5 = [int5 countBytes];
unsigned char bytes[numBytesInt5];

[int5 toByteArrayUnsigned:bytes];

for(unsigned i = 0; i < numBytesInt5; i++)
{
     NSLog(@"Byte %d: %X", i, bytes[i]);
}

安装

您可以通过在 CocoaPods 中添加到您的 Podfile,轻松地将 JKBigInteger 添加到项目中。

pod 'JKBigInteger', '~> 0.0.1'

有关更多详细信息,请参阅'Pod' 语法参考

鸣谢

JKBigInteger 由 Jānis Kiršteins 创建。

许可

JKBigInteger 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。