Re: int128_t
Re: int128_t
- Subject: Re: int128_t
- From: "Clark Cox" <email@hidden>
- Date: Fri, 17 Oct 2008 15:58:48 -0700
On Fri, Oct 17, 2008 at 1:16 PM, Paul Russell <email@hidden> wrote:
> On 17 Oct 2008, at 20:26, Chris Espinosa wrote:
>
>> On Oct 17, 2008, at 12:07 PM, Mark Wagner wrote:
>>
>>> Take the US national debt, around 10 trillion dollars. Convert it to
>>> a currency with a high exchange rate, e.g. the Zimbabwean Dollar at
>>> around 2.5 trillion to the dollar as of July, and just for the hell of
>>> it multiply by 100 (to allow for hyperinflation over the next month).
>>> That's 10^28, which needs log(28) / log(2) = 93 bits. Why do you
>>> think 128 bits will be enough?
>>
>> Because 128 bits is 34,359,738,368 times larger than 93 bits. Thirty four
>> billion times larger.
>>
>> Regardless, vBigNum is the header you're looking for if you really want
>> 128-bit integer arithmetic (or 256 or 512 or 1024 for that matter).
>>
>>
>> file:///Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/vecLib.framework/Headers/vBigNum.h
>>
>> I think we can close this thread.
>>
>
> One final comment and I'll shut up: 128 bit long doubles have 106 bits of
> precision, which should be more than enough,
Not quite. Without an infinite number of bits of precision, it is
impossible to exactly represent 0.01 in binary floating point. This
makes floating point variables inherently unsuitable for use in
financial calculations.
For this reason, one should either use integers (i.e. deal with cents,
instead of dollars), or work in decimal (i.e. use an appropriate math
library)
> even for Zimbabwe, if it should decide to take on the US national debt.
>
> Paul
>
>
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
>
--
Clark S. Cox III
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden