Questions tagged [base-conversion]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
-1
votes
0answers
18 views

C question: If int x = 0x FEDCBA98 , what is the value of x >> 24? 0x0, 0x24, 0x FE, or 0x FFFFFFFE? [closed]

If int x = 0xFEDCBA98, what is the value of x >>24? a.0x0 b.0x24 c.0xFE d.0xFFFFFFFE The answer is somehow d. Here is my reasoning: first, convert 0xFEDCBA98 to binary, getting ...
2
votes
1answer
27 views

Conversion from octal numerical system to binary numerical system

I know that in order to convert a numeral in base-8 to a numeral in base-2 I can write each octal digit as a binary word of 3 bits. I know that 2^3 = 8 that is exactly the dimension of the base of ...
0
votes
0answers
43 views

An interesting compression algorithm idea

I stumbled on this paper about compressing images using a kind of odd, but interesting idea. It seems pretty easy to implement and I was wondering if there is something wrong with it that I haven't ...
3
votes
3answers
1k views

Algorithm to convert a fixed-length string to the smallest possible collision-free representation?

I have a US-based telephone number (in the format 000-000-0000) and need to convert it to a "shorter" representation. Using base32/64 produces too long of a string. I've discovered CRC-16, which ...
0
votes
1answer
217 views

Find n-th number in a number system with only 3 and 4

Given a number system with only 3 and 4. Find the nth number in the number system. There is a solution given here but its very vague without explaining the mathematics/ concept behind it. Can someone ...
1
vote
2answers
72 views

Time complexity of expanding decimal to new base

There is already a post on this topic on stackoverflow. Nevertheless, I am asking the question here again, primarily because I do not understand the answer given there, and also because I have some ...
1
vote
1answer
75 views

How to convert between bases partially?

I have some large number $n$ in base $b_1$ and I want to convert it to base $b_2$. $n$ is about a million decimal digits long, therefore it's impractical to convert it as a whole. However I don't need ...
1
vote
1answer
136 views

Is there an online algorithm for radix conversion?

Suppose I have $P$, which is the base-$p$ representation of an integer $n$ and I want to calculate it base-$q$ representation $Q$. The obvious algorithm is: interpret $P$ to obtain $n$, then ...
1
vote
1answer
56 views

Shortest decimal expansion within binary interval

Consider an interval $[x-2^n,x+2^n]$ defined by a binary float $x$ and a power of two $2^n$ typically much smaller than $x$. I would like to know whether an efficient algorithm exists to determine the ...
0
votes
2answers
516 views

Convert a decimal floating-point number into a binary floating-point number

Let's say I have a decimal floating-point number, i.e. a mantissa and precision (negative exponent), both represented as integers. How do I convert this into a binary floating point number (of the ...
0
votes
0answers
121 views

As a number (base 10) approaches infinity, what would be longer? Represented in BCD or Base-2?

My professor asked this question in his lecture class and I can't figure out the answer. My guess is BCD because you can't use up all the numbers (10 to 15), so you eat up space?
0
votes
0answers
177 views

How can I convert a binary number to a base-4 number with a Turing Machine?

I'm looking for some guidance to get me going. I assume (and please correct me if I'm wrong) that it'll need 2 tapes and by reading various resources, I found that it might be easier with the binary ...
-1
votes
1answer
2k views

Writing a Turing Machine that convers a number from binary to decimal

I'm trying to write a Turing machine that can convert a number in binary representation to a number in decimal representation. For example if the input on the tape is 1101 the output should be be 13. ...
0
votes
1answer
61 views

Optimal way for the remainder [closed]

I want to know if for any base the most significant digit is 1 or not. Here is the code: ...
-1
votes
1answer
243 views

Newbie: hexadecimal editors to make sense of binary files [closed]

As a disclaimer, I am a geophysicist, not a computer scientist. I have a binary file with a whole bunch of data in it (it is a large file; 221 MB). I am trying to convert this to something usable but ...
1
vote
1answer
101 views

Convert non-integer decimal to octal

I follow a course in Computer Architecture and I'm making exercises on number conversions. Now one of the questions asks me to convert 251.5625 to octal and hexdecimal base. No further info is given. ...
3
votes
2answers
12k views

Algorithm to convert decimal number to binary

I am reading this material to understand the basics of number system. I am stuck at a point in that material where it writes the algorithm to convert a decimal number to binary number. The heading of ...
-2
votes
1answer
91 views

Hex to decimal conversion [closed]

I'm converting hex ( in positional fractions) to decimal question : 0x3c.e8 my attempt: $3*16^1 + 12*16^0$ yields $60$ $ 3c$ = $ 60 $ in decimal so i know its 60. then $.e8 *10 $ (since I want ...
1
vote
1answer
628 views

Efficient algorithm for conversion of hexadecimal fraction to decimal fraction

Let's say I have some very long hex fraction like this: 0.3F30A21306AEFCBADE3230A593EFAEB395A39E What are some algorithms with an acceptable complexity to ...
5
votes
1answer
294 views

How to find a basis which is guaranteed to need 9 or less characters to represent a 12 digits number?

I'm trying to map a 12 digit number into a fixed width file. For a number of reasons, it must be compressed in such a way that it is guaranteed to be less than or equal to 9 characters (alpha numeric ...
0
votes
1answer
169 views

$25_r = 23_{10}$ solve for the base r

first of all this is a homework question and I don't want the solution. I just want a reference to how to solve similar questions like this. I believe it's explained my course textbook, "Computer ...
0
votes
1answer
372 views

conversion to base-R numbers

I am reading Algorithms 4th edition by Robert Sedgewick and am stumped at a particular problem. On page 460 of the book the author is describing a technique to hash strings and use prime numbers for ...
2
votes
2answers
618 views

Finding the values of x and y using base 8 [closed]

In finding the values of x and y, if (x567) + (2yx5) = (71yx) ( all in base 8) I proceeded as under. I assumed x=abc and ...
6
votes
1answer
107 views

Base conversion puzzle

Here's an old puzzle: Let $s$ be a string of decimal digits ($s[i] \in \{0,\dotsc, 9\}$). Define a function $f(s)$ as follows: Interpret $s$ as a decimal number, $n_{10}$, and convert $n$ to its ...