Anything related to number systems, i.e. the way of representing numbers (the abstract mathematical entities) as finite sequences of symbols. Usually this tag is relevant on questions involving conversion from the representation in a number system to another (e.g. from decimal to binary).
Questions tagged [number-systems]
106 questions
0
votes
0 answers
Do you know how to convert from bases in python?
How do you convert base 12 to base 10 in Python 3 and the other way around too? (from 10 to 12)
I wrote this code to make a list of numbers in base 4, but the code never executes and eventually has a timeout error. Any ideas on how to fix it? It…

Adi
- 1
- 4
0
votes
1 answer
converts signed decimal numbers to signed binary and vice versa
Can't Write Decimal To Binary and vice versa converter that works with the positive and negative numbers.
This Decimal To Binary Converter works fine
# decimal to binary
def to2sCompStr(num):
bitWidth = 8
num &= (2 << bitWidth-1)-1
…

PR0X1M4
- 3
- 3
0
votes
2 answers
Stuck in decimal to binary using C
Below is a function I created to convert a decimal number to binary:
int dtob(int n)
{
int bin = 0;
int i=0;
while(n>=1)
{
bin += pow(10,i)*(n%2);
n=n/2;
i++;
}
return bin;
}
Now this function gives…

Sharvansh Shukla
- 13
- 3
0
votes
1 answer
8's complement of a fractional octal value
Well the question is that I have to perform an octal subtraction using 8's complement method. The question is like this: (611.21)base 8 - (304.42)base 8. Subtraction part is fine but the problem comes when taking the 8's complement of the number.…

Utkarsh Sahu
- 409
- 3
- 16
0
votes
1 answer
How To Do Direct Conversion From One Number Base To A New Number Base
I want to understand direct conversion from one number base to a different number base. What are the steps that work for any number base to another number base? What I am looking for is not a short cut method which works for say, binary to octal or…

Shalini
- 3
- 2
0
votes
0 answers
Number system conversions with extremely large numbers
I tried to make a number system converter in which I got successful, but when it came to larger numbers then we have some boundaries, so how I can deal with largest numbers in c++, I tried to make a division function which divides number into parts…

Nazakat Umrani
- 1
- 1
0
votes
1 answer
Why am i getting typeerror for running a simple function in a loop?
i am writing a function to take an ip address, convert each of its parts(separated by '.') into an 8 - bit binary digit. then i want to combine all the binary numbers and get one big 32 bit number, and i want to convert it to decimal. my convert…

Aaditya Sahoo
- 3
- 1
0
votes
1 answer
How does the result of Binary Arithmetic(Subtraction) using 2's complement get a negative answer?
Ok, so here's the problem: 11100111 - 110011111
I am aware of the fact that we have to use 2's complement method for gaining the right answer but when I do use it by changing 110011111 to 001100000 and then add it to 11100111, I get…

Kaya
- 1
- 1
0
votes
0 answers
There is a problem in this C++ program (Decimal to Bin,Oct and Hex converter)
What I am trying to do is, create a program which converts Decimal values into other Number Systems(Binary, Octal and Hexa-Decimal) and shows the original Decimal value as-well-as the converted value.
It runs fine in first run but when the outer for…

Jester
- 1
- 3
0
votes
3 answers
Subtract two octal numbers directly without converting to decimal
How can a subtraction be done?
Deciding on the stopping condition - you want your while loop to continue until both numbers a, b, and carry turn zero. In other words, the condition should be a || b || carry
Adding the next digit to the sum - since…

askomal
- 1
0
votes
1 answer
How does a decimal get converted into dotted decimal
Is the way to convert the decimal to hexadecimal and then to doted decimal.And does it always have to be 10 digit decimal.

Ajai Agarwal
- 3
- 4
0
votes
1 answer
Convert decimal number into binary using recursion in C
I had this code. Everything is fine with the code. The only thing is I am not getting why we are multiplying by 10 in last second line when the function convert() is being called recursively.
#include
int convert(int);
int main()
{
int…

Shaziya Hasan
- 25
- 10
0
votes
3 answers
how do i randomly generate a binary number in javascript?
I'm making a simple program where i make a number system conversion quiz but i don't know how to generate a binary number in Javascript.
the user chooses what kind of conversion he/she likes. (eg: binary to decimal, decimal to hex etc)
it also asks…

lés
- 41
- 10
0
votes
1 answer
When two variables is logically compared, the logic gate that tests the equivalence is? Using logic gate
When two variables is logically compared, the logic gate that tests the equivalence ..
If XOR please explain Why ?
if XNOR Please explain Why?

Sabuj Sarker
- 39
- 8
0
votes
2 answers
Floating point number representation
This is quite old question asked in 1996, so ignore the errors.
Here the exponent is of 8 bits then we will take bias as 128 Right ? but how to proceed further in the question please help.

Sanjay Verma
- 101
- 13