# Questions tagged [base-conversion]

The tag has no usage guidance.

34 questions
Filter by
Sorted by
Tagged with
14 views

### What would be the simplest and quickest way to convert Morse code to "strict" binary?

I'm trying to find a way to easily convert strings of morse code into strings of "strict" binary, in the way that it is described in this answer. Specifically, where: A dot is represented ...
24 views

### How to store very large numbers on the computer using string and base (GMP algorithm)

I was programming a small bignum library (like GMP). I started with the unsigned integer numbers. Currently, I'm looking for a way to be able to take a number in any base (2, 8, 10, 16, etc.) as a ...
29 views

### Computability of base-conversion for streams

With regular numbers it is always possible to convert them from one (integer) base to another. But what happens if we consider numbers for which their magnitude is not known in advance, or in other ...
31 views

### What does it mean when asking to Convert 16-bit binary numbers to two 8-bit signed integers (two’s complement) in decimal

The question is Convert the following 16-bit binary numbers to two 8-bit signed integers (two’s complement) in decimal. i. 0b 0011 0110 1101 0100 I first flipped it and added 1 to it which equaled ...
28 views

### How to convert a string (number representation) to an arbitrary base using custom alphabet?

I'm trying to figure out an efficient way (without recursion) to convert a string (number representation) from one arbitrary base to another using custom alphabet. But I cannot think of a very fast ...
336 views

### Arithmetic on signed 12-bit octal number stored in sign magnitude form

What is 4365 − 3412 when these values represent signed 12-bit octal numbers stored in sign-magnitude format? The result should be written in octal. Show your work. Octal to binary: 4365: 100 011 110 ...
35 views

### Why is the carry of any n base system equal to the radix in arithmetic?

In binary the carry/borrow is 2, in hex the carry is 16. What's the reason for this?
18 views

### Conversion of fractional part of a hexadecimal number to binary

The Number is given as : (C012.25)Hexadecimal I have to convert it into octal . So I converted it into Binary First and got the result as : 1100000000010010.01000000 (Since each bit in hexadecimal ...
812 views

### 4-digit 5's complement of a negative number

Let $n = -13, \ k = -24$ How do I find the 4-digit 5's complement of each number? What would be the result of $n + k$ in complement representation? I understand how to calculate $n$-digit, 2's ...
198 views

### Streaming digit-to-digit conversion from decimal to hexadecimal

I am looking for a streaming algorithm for converting a decimal number to a hexadecimal number. I am assuming the input is a string represention of a decimal number (i.e., each character is a decimal ...
65 views

### Converting from m base to n base without arithmetic operations (Where m<n )

I have been working the last 8 years in try to convert from base n to base m without artihmetical operations. My hypothesis is that by the same way that is possible convert bases without division (...
41 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 ...
2k 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 ...
61 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 ...
60 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 ...
3k 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. ...
717 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 ...
346 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 ...
219 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 ...
85 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 ...
666 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 ...
122 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?
330 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 ...
63 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: ...
371 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 ...
195 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. ...
17k 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 ...
98 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 ...
878 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 ...
296 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 ...
174 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 ...
390 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 ...
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 ...