Questions tagged [number-systems]

Questions about representing numbers in alternative representations, such as hexadecimal or Mayan

Filter by
Sorted by
Tagged with
1
vote
1answer
118 views

Base conversion [closed]

I wrote a base conversion program. This base conversion should also work with base 1 (unary) where 000 is 3 and 0000000 is 7 and so on. It is only for non-negative numbers. ...
3
votes
1answer
1k views

Decimal to Binary Conversion and vice-versa in Python

Given a decimal number I need to convert it into binary Given a binary number I need to convert it into decimal After the conversion I need to perform some operation on it (for example, addition). I ...
1
vote
1answer
74 views

Android UI for converting numbers from base system x to base system y

As a complete beginner, I didn't care about how the code looked as long as it works. However, now I am starting to think about how to make code be more maintainable and easier to read. I feel I have ...
4
votes
2answers
292 views

Converting an integer to Greek and Roman numerals

Yesterday I posted a question about converting an integer to it's Roman Numeral equivalent. Apparently you guys liked it and gave me some good advice, so I decided to take all your advice, and go a ...
3
votes
1answer
1k views

Implementing my own Integer.toBinaryString(int n) method

Our senior developer gave us (trainees/jr. developers) a small exercise and that is to make our own Integer.toBinaryString(int n) implementation. This is the answer ...
2
votes
3answers
40 views

Filtering out neighboring ascending digits in quaternary numeral system

Take in a natural number n ∈ N, then process and output a(n), with a(n) being the number of quaternary strings (with 0, 1, 2, 3) of length n, where (from left to right) there never follows a character ...
3
votes
2answers
351 views

Converting bits to decimal (integer) string is so slow

I am implementing myself a BigInteger class. It can natively handle very very big digits in very short time. ...
3
votes
2answers
6k views

Base 10 to Base N conversion

Before I begin using this code in vital systems, I wanted to quadruple-check that it was soundproof. I plan to implement this as part of a larger program, obviously not by itself. Are there any clear ...
2
votes
1answer
449 views

Program for binary to decimal and vice versa

I started to learn C a week ago and this is my culminating program of what I've learned but I could use a few pointers. ...
0
votes
1answer
800 views

Base N To Decimal Converter

Problem Implement a base N to base 10 (decimal) converter, where N is between 2 and 36 inclusive. Implementation Am I over-complicating things in ...
2
votes
0answers
832 views

Hex to Binary Conversion

Just mucking around with Elixir and bitstrings and wondering if there is a better way to implement the following ( or improve ). :- ...
0
votes
1answer
839 views

Binary to decimal converter in JavaScript

This exercise with a test suite is from here. I did not intend to use ES6 features, it's plain old JavaScript. That's why I seek advice more on the good practices, performance side, than modern syntax....
2
votes
1answer
284 views

The base-ten value of n-base number with Python

To start off I'd like to note I am aware of int(val, base). My goal was to write a short function capable of taking in a base int...
1
vote
1answer
166 views

Python Decimal to Binary converter

There is no input validation for this, but that aside, I would appreciate it if anyone could help me improve the logic of this script. ...
2
votes
1answer
765 views

Python binary to decimal converter

Any ideas how I could improve this? I already know that there is no checking for anything other than a 1, so you can enter a 2 ...
4
votes
1answer
2k views

Binary-octal-hexadecimal conversion table

I solved this exercise of displaying a table of numbers from 1 to 256 in binary, octal and hexadecimal. I made this program to convert from decimal to binary and took that binary number to convert to ...
2
votes
0answers
70 views

Subtraction in a spreadsheet column numbering scheme

The idea of the algorithm is to decrease a number from a word. Is there a better way to write this algorithm? limitiation: it is important to decrease with a limit, if BB is the word we decrease ...
7
votes
3answers
4k views

Converting decimal integer to binary string

I'm wondering how I can make this function better, more compact, even faster. ...
4
votes
1answer
929 views

Program to convert binary to hex

I wrote this program to convert binary to hex, it ignores other characters between the binary digits. I would like to receive any recommendations on how to improve it. ...
4
votes
2answers
144 views

Convert integers into binary

I've made a very simple program that takes integer number arguments either with plus/minus sign or without them, and print the number in binary format. binary.c ...
4
votes
1answer
35 views

Base Changing in Java, improved version

This is a follow up to my previous question, Base-changing numbers in Java I have followed @Pimgd's advice in the answer to that question, and I'm posting the improved code for any further review. ...
5
votes
1answer
102 views

Base-changing numbers in Java

On a whim, I came up with this program to act as a helper class for base changing, if I require it in the future. It was made to support fixed-point and negative inputs, but they are basically a hack. ...
3
votes
1answer
60 views

itoa with “method of complements” for negative numbers in ANSI C

I have enhanced my itoa implementation, taking the advise from my previous simple itoa implementation in addition to handling multiple radixes and negative numbers other then just base 10. Looking for ...
2
votes
2answers
564 views

Decimal number to binary number conversion in JavaScript

I made this decimal to binary conversion as an exercise for myself and because it is obviously often asked during job interviews / tests. Any hints concerning possible improvements welcomed. <...
3
votes
2answers
9k views

JavaScript function to convert decimal number to binary

I was recently asked this in an interview for a front-end position and I came up with something like the code below, which seems to work but is clunky. (...
4
votes
1answer
95 views

Multiple base numbers parser

This code is a Parser that parses numbers according to R5RS. #b1001 - binary #o2127 - octal #h02d - hexadecimal #d1231 - decimal 3923 - decimal It is working ...
1
vote
2answers
625 views

Hex-to-octal converter

The code converts hexadecimal into octal. The function is working, but it takes more than a second to process the input. How can I optimize this? ...
3
votes
2answers
3k views

Convert decimal to binary and vice-versa in Java

I'm trying to learn Java, so I'm doing a few exercises from a programmer project idea book. This exercise requires that the program be able to convert a decimal number to binary and vice versa, like ...
11
votes
4answers
1k views

Arabic to Greek numeral converter, 1 - 10

One of the things that's straight-forward in JavaScript is Unicode support. If you want to return ϝ (lowercase digamma, not a simple ...
4
votes
2answers
249 views

Converting hex to integer

What's the fastest way of doing this? ...
7
votes
1answer
2k views

Function to convert a decimal number as a string to hexadecimal

I am designing a cipher and need to convert between bases repeatedly in a loop. I have optimized everything else, but I'm not too familiar with C++ code, and and am trying to figure out how to make ...
6
votes
2answers
4k views

Java conversion of base 16 to base 64

I wrote a solution in Java to solve the problem here. I use BigInteger to convert first from base 16 to base 10, then base 10 to base 64. This seems quite ...
4
votes
2answers
13k views

Hexadecimal number to decimal conversion

I am a semi-beginner in C++ and I have a project in C++ to convert a hexadecimal integer into decimal equivalent, but I extended it and now this program can also convert a fractional part. Logic I ...
3
votes
1answer
17k views

Conversion functions between binary, hexadecimal and ASCII

I've written a small suite to easily convert my data between binary, hexadecimal and ASCII: ...
5
votes
4answers
19k views

Hex to Decimal converter

Any feedback is welcome: ...
4
votes
1answer
7k views

All-in-one number base converter

I coded this program as a challenge for /r/dailyprogrammer. Basically this program can convert any number from any base to another base including negative bases as long as the input is coherent. Did I ...
4
votes
2answers
2k views

Excel-like column numbering

I have a working code (below) to convert a number to Excel-like (A...Z AA...AZ BA...BZ ...ZA-ZZ) column codes (headers). For ...
16
votes
1answer
21k views

Excel column string to row number and vice versa

Excel column letters to actual numbers, if you recall, Excel names its columns with letters from A to Z, and then the sequence goes AA, AB, AC... AZ, BA, BB, etc. You have to write a function that ...
5
votes
3answers
4k views

Decimal/binary/hex converter

I've finally finished my converter and have determined that it works, but I'm trying to make it cleaner and/or more practical (primarily with the switch statements)....
7
votes
4answers
1k views

Printing all binary strings of length n

I have completed my homework with directions as follows: Declare and implement a class named Binary. This class will have a method named printB(int n) that prints all binary strings of length n. ...
9
votes
1answer
6k views

Implement numbering scheme like A,B,C… AA,AB,… AAA…, similar to converting a number to radix26

I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below ...