But why should I go to the trouble and hassle of finding and using some math package that can handle thousands of bits when I can just do something like
k = log(2) * D;
and get a number that is good to less than 1% even for D = 100 and gets me to 13 sig figs with D = 1e13?
As D gets larger, this approximation just gets better and better.
It's my understanding that even with state of the art bignum packages that evaluating elementary functions of 4000 bits is going to be a few hundred times slower than a 64-bit representation, even if no hardware support is available for the 64-bit number, which is usually not the case. So we are more likely talking about at least a factor of a thousand in practice.
Yes, at some point k can't be represented directly as a limited-precision floating point value, but that's fine. Long before we get there, we can scale D and track the exponent separately.
And remember -- the point of the thread was to explore why two approximations weren't agreeing. Taking the approach of "well, just use arbitrary-precision arithmetic and then don't do any approximations" completely fails to address the point.
Furthermore, the point of the formula in the first place is not to come up with a specific number k for a specific number D, but to come up with a formula that shows how k scales with D. Cranking numbers all day long with a bignum library isn't going to come close to being able to say, very succinctly,
k = ln(2)·D = O(D)
k = log(2) * D;
and get a number that is good to less than 1% even for D = 100 and gets me to 13 sig figs with D = 1e13?
As D gets larger, this approximation just gets better and better.
It's my understanding that even with state of the art bignum packages that evaluating elementary functions of 4000 bits is going to be a few hundred times slower than a 64-bit representation, even if no hardware support is available for the 64-bit number, which is usually not the case. So we are more likely talking about at least a factor of a thousand in practice.
Yes, at some point k can't be represented directly as a limited-precision floating point value, but that's fine. Long before we get there, we can scale D and track the exponent separately.
And remember -- the point of the thread was to explore why two approximations weren't agreeing. Taking the approach of "well, just use arbitrary-precision arithmetic and then don't do any approximations" completely fails to address the point.
Furthermore, the point of the formula in the first place is not to come up with a specific number k for a specific number D, but to come up with a formula that shows how k scales with D. Cranking numbers all day long with a bignum library isn't going to come close to being able to say, very succinctly,
k = ln(2)·D = O(D)