• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Big/Arbitrary integers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Big/Arbitrary integers


  • Subject: Re: Big/Arbitrary integers
  • From: Greg Herlihy <email@hidden>
  • Date: Mon, 23 Jan 2006 18:39:28 -0800
  • Thread-topic: Big/Arbitrary integers

If you are compiling with gcc 4.0, long double (at 128 bits, or about 33
decimal places of precision) is probably a better choice than
NSDecimalNumber at this point. In fact judging from Tiger's release notes
NSDecimalNumber appears to be destined for deprecation, once NSNumber adds
support for long double.

However neither long double nor NSDecimalNumber (nor the NSDecimal C
implementation upon which it is based) support arbitrarily large integers.

For a "native" implementation of a big integer library (that is one that
ships on every Mac), I would look at openssl's Big Number library whose
interface is found in <openssl/bn.h> and whose documentation can be found in
the "bn" man page and whose source can even be downloaded from the
openssl.org web site.

Greg

On 1/23/06 5:29 PM, "Adam Leonard" <email@hidden> wrote:

> Also take a look at NSDecimalNumber. From the docs:
> "An instance can represent any number that can be expressed as
> mantissa x 10^exponent where mantissa is a decimal integer up to 38
> digits long, and exponent is an integer from ­128 through 127."
>
> Adam Leonard
> On Jan 23, 2006, at 4:19 PM, Shon Frazier wrote:
>
>> Is there a Cocoa API for arbitrarily large integers?  I've searched
>> and cannot find any references in the ADC docs.
>> I'm aware the the GPL'd GMP library, but I'm hoping for something
>> more "native".
>>
>> Thanks in advance,
>>
>> --Shon
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Big/Arbitrary integers
      • From: Shawn Erickson <email@hidden>
References: 
 >Re: Big/Arbitrary integers (From: Adam Leonard <email@hidden>)

  • Prev by Date: Re: Big/Arbitrary integers
  • Next by Date: Re: suppressing the scod at startup
  • Previous by thread: Re: Big/Arbitrary integers
  • Next by thread: Re: Big/Arbitrary integers
  • Index(es):
    • Date
    • Thread