Questions tagged [base-conversion]

Base conversion is the process of changing the base of the textual representation of a number to another base. For example, "1010" in binary to "10" in decimal is a base conversion.

Base conversion is the process of changing the base of the textual representation of a number to another base. For example, 1010 in binary to 10 in decimal is a base conversion.

198 questions
0
votes
0 answers

how to convert a number from base 10 to any other base using Little Man Computer

I need to create a program that takes as the first input : A decimal number and as a second input the number of the base it will be converted to . then outputs the result of the conversion . I looked everywhere on the internet but i cant seem…
soso xoxo
  • 1
  • 4
0
votes
2 answers

C Language Convert Number Bases

I need a program that: Can convert any number in a specific base and convert it in another base. It must work for real numbers (e.g 7.34 , 3.14, etc.) Input: number1, base1, base_to_which_it_must_be_converted Output: Converted number: I managed to…
0
votes
0 answers

Decimal to Binary Conversion ASM 3 digits

I was given a task to convert decimal input numbers and output its binary equivalent via an "array" using assembly. I've the code complete and working, trouble is it only accepts numbers 0-99 for conversion. Ideally, the program should be able to…
0
votes
0 answers

PHP Convert large binary code to string

I need to convert a large collection of binary to a string. The code I used to get the binary code is: $buffer = file_get_contents('test.php'); $length = filesize('test.php'); if (!$buffer || !$length) { die("Reading error\n"); } $_buffer =…
Rajind Pamoda
  • 143
  • 2
  • 10
0
votes
1 answer

Convert from base 10 to an arbitrary radix with proper sign extend

I was wondering if there's a formal way to properly sign extend base-10 numbers in an arbitrary base when converting. For example, if I had -256 in base 10, how would I properly sign extend the result in base 7 (or base n) without assuming a fixed…
user3639182
  • 47
  • 1
  • 6
0
votes
1 answer

Compress hash output (from hex to "higher" representation)

I have a 40 character long SHA1 value that is stored in an indexed column in a InnoDB table. To shorten the index I want it to be "compressed" without increasing the risk for a collision.
Julius S.
  • 664
  • 9
  • 21
0
votes
3 answers

How would i count up in binary with leading zeros?

So I want to count up in binary but keep the leading zeros in example to count to 6 it'd look like this: 0000 0001 0010 0011 0100 0101 0110 I have this code but it only goes up to a certain amount specified by repeat=4 and i need it to go until it…
Bot
  • 59
  • 8
0
votes
1 answer

Algorithm to convert complex number to Quater-Imaginary base without radix

Note: I don't know if this belongs here or on the math exchange, but I'll start here because I'm shooting for numerical solutions. I need to convert complex numbers of the generic form $x+yi$ into base $2i$ (the Quater-Imaginary Base), preferably…
opticaliqlusion
  • 327
  • 2
  • 13
0
votes
1 answer

How to put numbers of an integer in a vector in C?

I wrote a function in C that convert a binary number to a decimal one: while (n != '\n') { scanf("%c",&n); if (n == '1') var = var * 2 + 1; else if (n == '0') var *= 2; } Now I wonder how to put each number of the…
Alopex
  • 131
  • 1
  • 1
  • 8
0
votes
3 answers

Conversion from hex to binary keeping 8 bits in Java

I need to write in a 8x8 matrix the binary values of 8 hexadecimal numbers (one for row). Those numbers will be at the most 8 bits long. I wrote the following code to convert from hexadecimal to binary: private String hexToBin (String hex){ int…
vandermies
  • 183
  • 3
  • 14
0
votes
1 answer

How do I convert a big number (e.g. 1.23e29) to IEE 754 single-precision floating-point format?

I learned how to convert from decimal to IEEE 754 through here, but I have no idea of how to convert a really big number without having to divide it all by the method explained on the post. For example, I have to convert -1.5845632e29 to IEEE 754…
Mikael
  • 969
  • 12
  • 24
0
votes
0 answers

How to improve the precision of this base converter function on Matlab?

I'm trying to create a function on Matlab that converts a base 10 (decimal) real number into another base. I wrote this function: function [converted_number] = base_converter(base,number,digits) format longG separator='…
user50746
  • 281
  • 2
  • 4
  • 10
0
votes
1 answer

Algorithm to convert from radix 256 to multi-radix and back

I have a data stream of bytes, also known as radix 256 symbols. What is the best algorithm to convert that, ideally on the fly, to a new stream of symbols where the radix of each symbol varies and is only known at runtime? The lengths of the input…
Reinderien
  • 11,755
  • 5
  • 49
  • 77
0
votes
1 answer

Convert a base 10 number to an arbitrary 'simulated' high base in PHP

I have searched pretty extensively for this and cannot find anything. Here is the problem: converting a base 10 number into a very large base, such as base 400. The purpose of this is simply educational. I know that there are not enough ASCII…
0
votes
2 answers

Python Code for Bin, Dec, Hex string Identifier & Converter

I need Python code that takes a number input as a string and detects if it is binary, decimal or hexadecimal. Also, I want to convert it to other two types without using bin(),dec(),hex(),int() commands.