[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Possible improvements to the LNUM patch?
- From: David Kastrup <dak@...>
- Date: Mon, 14 Apr 2008 23:31:46 +0200
glen@worstell.com writes:
> The next easiest way is to simply use cents. This requires that input
> data be checked and converted. This method will easily handle amounts
> as large as the deficit created by the current administration (and
> congress, who is just as guilty as Bush because they just rubber stamp
> all his requests).
Financial calculations are usually done in tenths of cents.
> Oops- political ranting not appropriate on this forum. Still, the answers
> about financial data in Lua are, I hope, useful to someone. IMHO it is
> wasted effort to create a special data type, at least without checking to
> see if a float will work for you. The integer part of a float is something
> like 48 bits (I forget - look it up)
23bit, completely insufficient. So let's hope we are talking about
"double" instead.
> which will allow exact storage of numbers that I will bet are large
> enough for any financial application.
If we are looking at tenth of cents, an IEEE double will take us all the
way to 2^53-1, which is 9007199254740991, namely $9,007,199,254,740.991.
That's not even a safety margin of 2 for the current gross deficit.
When we are talking about things like stock capitalization or GDP, we
are clearly out. And I am not really too sure whether it is "2^53-1" or
"2^52-1" I should be talking about here.
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum