Re: Binary number digits <- > Decimal number digits



On Dec 9, 10:50�am, Jeremy Boden <jer...@xxxxxxxxxxxxxxx> wrote:
On Sun, 09 Dec 2007 16:58:11 +0100, Helmut Richter wrote:
On Sun, 9 Dec 2007, fc wrote:

For example, what calculus was made to arrive that a decimal number of
617 digits must have 2048 digits in binary? (Obviously, without make
the conversion of the decimal number 999999...99999 [617 9 numbers] to
binary) And: how to generalize for any decimal number of any length?

The number of digits of x in some base b is, not regarding rounding to
integers, the logarithm of x with respect to base b, which is �log x /
log b (log to arbitrary base).

So the number of decimal digits of x is �log 2 / log 10 = 0.30103 .

For a rough calculation, 2^10 = 1024,
So 10 bits is approximately 3 digits.

How come you didn't round up?

3.0102999566398119521373889472449 rounds to 4
giving you the correct answer: 10 bits makes
4 decimal digits.


--
Jeremy Boden
"64 bits good, 32 bits bad"

.



Relevant Pages

  • Re: XQ and ->Qpi bug on large X
    ... you shouldn't be rounding to only two digits ... I am trying to make a similar point here about rounding; ... and round it, ... prior to using the input values in calculations. ...
    (comp.sys.hp48)
  • Re: Decimall Float Question
    ... the number other than to round the decimal part. ... 'bankers rounding' to the nearest even number is not required). ... the FAQ code includes having a variable number of digits after ... // Convert number to string and split ... ...
    (comp.lang.javascript)
  • Re: check decimal and if numeric
    ... so effectively truncates an subsequent digits for positive numbers. ... It's different when you round negative numbers down, ... decimals, who's to say the third or fourth digit was the one that was in error? ...
    (microsoft.public.access.formscoding)
  • =?Utf-8?Q?Re:_I_don=C2=B4t_view_the_value_right?= =?Utf-8?Q?_after_six_decimal_place_in_Exce
    ... Excel does by default, but instead you wanted to round down or truncate, you ... Presumably MS chose not to display more than 15 digits because not ALL 16 ...
    (microsoft.public.excel.misc)
  • Re: Monetary calculations in CL
    ... you can implement the rounding rules ... E.g. suppose you are to round to the nearest 0.01 such that: ... (defun round-even-odd-rule (input digits) ... (multiple-value-bind (int frac) ...
    (comp.lang.lisp)