"Tom Lane" <[EMAIL PROTECTED]> writes:
> Patric Bechtel <[EMAIL PROTECTED]> writes:
>> Tom Lane schrieb am 02.03.2007 14:38:
>>> Exact decimal fractions are no longer exact when converted to base 2.
>> I think multiplying with base 10 until it's a whole number, then saving
>> that exponent with it, that's how I understood it.
> That hardly seems likely to win in terms of calculation efficiency ---
> for example, adding two numbers will now likely require a multiplication
> in order to align the values for addition. Having to store the exponent
> doesn't sound that great for the original complaint of too much overhead
> for short numbers, either...
Adding two numbers with two different exponents would require multiplying to
set the exponents equal.
a) normally you're adding together numbers of the same type so normally you'll
have the same precision.
b) It's only going to hurt for very large numbers where handling base-10^n
numbers is *so* bad that the argument kind of breaks down.
c) I was picturing storing the exponent relative to the decimal place instead
of relative to the first digit as we do now. That means numbers like 1x10^6
might take more space but numbers like 123456 would take less since we
could define a missing exponent to represent an exponent of 0.
Incidentally -- doing what I just castigated Jonah for doing -- I looked
around and both libgmp and the java math.BigDecimal libraries use base-2
digits. The latter with base-10 exponents no less.
---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?