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
1
vote
0 answers

Decoding a string with base

I am having trouble decoding a number back into its character form. Each letter encoded using a base string of 96 letters Example: To code "DCODE", written in base 26, ABCDEFGHIJKLMNOPQRSTUVWXYZ, convert it to base 10: D=3, C=2, O=14, D=3, E=4 so…
Lizzy
  • 211
  • 2
  • 10
1
vote
1 answer

Fastest algorithm to convert hexadecimal numbers into decimal form without using a fixed length variable to store the result

I want to write a program to convert hexadecimal numbers into their decimal forms without using a variable of fixed length to store the result because that would restrict the range of inputs that my program can work with. Let's say I were to use a…
1
vote
3 answers

Why is it useful to know how to convert between numeric bases?

We are learning about converting Binary to Decimal (and vice-versa) as well as other base-conversion methods, but I don't understand the necessity of this knowledge. Are there any real-world uses for converting numbers between different bases?
samim
  • 41
  • 1
  • 2
1
vote
1 answer

php base_convert not working for non-integers?

I want to write 3.1415 (written under base ten) in base 8 using php. I'm expecting 3.11034, but base_convert(3.1415,10,8); is returning 75267... php.net says the first parameter should be a number but it clearly interprets it as an integer.
François Huppé
  • 2,006
  • 1
  • 6
  • 15
1
vote
1 answer

Generating 5 digit alphanumeric code with predifined characters in sequence

I would like to generate a membership number consisting of alphanumeric characters, removing i o and l to save confusion when typing. to be done in php (also using Laravel 5.7 if that matters - but i feel this is a php question) If simply using 0-9…
The-WebGuy
  • 877
  • 5
  • 12
  • 25
1
vote
0 answers

IEEE Floating Point Sign?

Heyy, I am working on an assignment which requires me to convert floating point numbers to binary representation using IEEE Float Representation. I am able to convert floating point from decimal system to binary but on one part I have to convert…
1
vote
0 answers

Faulty Validation Logic in Java Base Conversion

I have been doing research on this for a while, but I'm either not understand what I'm reading, or I am searching for the wrong thing. The program I am writing is to convert a number from base to base (2-36) without using a regex method, and…
S. Rouse
  • 19
  • 3
1
vote
1 answer

Logic behind the algorithm for converting base 10 to base X

What is the rationale behind the below algorithm : Algorithm to Convert From Decimal To Another Base Let n be the decimal number. Let m be the number, initially empty, that we are converting to. We'll be composing it right to left. Let b be the…
user1718009
  • 303
  • 3
  • 7
1
vote
2 answers

Converting Decimal to Octal Using Bitwise Operators

The below function is intended to convert its parameter, an integer, from decimal to octal. std::string dec_to_oct(int num) { std::string output; for(int i=10; i>=0; --i) { output += std::to_string( (num >> i*3) & 0b111 ); } …
Dando18
  • 622
  • 9
  • 22
1
vote
1 answer

Google OAuth in Python 3 error

I followed this awesome answer for implementing Google OAuth in Python. However, when I tried running in Python 3, I get this error: TypeError: ord() expected string of length 1, but int found This error is thrown by this line: o = ord(h[19]) &…
Daniel
  • 3,188
  • 14
  • 34
1
vote
2 answers

Error in hexadecimal conversion to base58-btc

I am using the conversion algorithm of http://lenschulwitz.com/base58 , this perl code. MANY GOOD CONVERSIONS, AS: 18e559fc6cb0e8de2ce8b50007d474a0d886208e698a07948671e0df520c1525 was converted to 2gBdDRXoLPEhgf9Zd7zw5ujK1qcoPZoendBQJ22VjgqS, all…
Peter Krauss
  • 13,174
  • 24
  • 167
  • 304
1
vote
1 answer

know the highest digit of a number

I'm doing an app in Xcode 8 with swift 3 that is a base converter, the input value is set with buttons: @IBAction func inputButton(_ sender: UIButton) { currentNumber = currentNumber * 10 + (the number I want to add) labelText.text =…
Diego Esc
  • 15
  • 4
1
vote
1 answer

Converting to and from a number system that doesn't have a zero digit

Consider Microsoft Excel's column-numbering system. Columns are "numbered" A, B, C, ... , Y, Z, AA, AB, AC, ... where A is 1. The column system is similar to the base-10 numbering system that we're familiar with in that when any digit has its…
Taylor Lopez
  • 813
  • 1
  • 8
  • 28
1
vote
1 answer

Negative 64bit Decimal Number to Binary in php

I am trying to convert a decimal number for example -268427136 to binary and vice versa. If I try with windows Calc, binary notation for this number is: 1111111111111111111111111111111111110000000000000010000010000000 If I try bindec,decbin or…
1
vote
2 answers

Why isn't my Bit String to Hex String code printing the result?

I am trying to print the result of a bit string to hex string conversion but it prints nothing. In other words 000110011101 should print "19d" are my temp variables the issue? Thanks in advance for any assistance, this is my code: public static void…
Peanutcalota
  • 135
  • 1
  • 8