Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [number-formats]

For questions about method for storing and manipulating numbers on computer systems, such as floating point or binary representations.

1
vote
2answers
34 views

Space-efficient representation of potentially very large arbitrary-precision rationals?

I'd like to know if there are good techniques for faithfully and (reasonably) representing rational numbers with forms similar to: 2/3 1/10 4 * 10 ^ 1,000,000,000,000 I know arbitrary precision ...
1
vote
1answer
26 views

What is the equivalent of the integers symbol Z for n bit only integers?

We refer to the set of all integers as $\mathbb{Z}$. Now suppose we have a set of integers that can be held within a computer variable of $n$ bits width. Clearly they can only be of $2^{n}$ range, ...
0
votes
0answers
24 views

Converting a decimal to IEEE754 32-bit binary number

Convert 0.625 to IEEE754 32-bit binary number. 0.625 x 2 = 1.250 0.250 x 2 = 0.500 0.500 x 2 = 1.000 So, ...
0
votes
1answer
50 views

Why isn't it necessary to store an integer part of significant in IEEE754 floating point notation?

We see that there is a sign, exponent, and mantissa part for the notation. But, there is no location for the significant bit. Why isn't it necessary to store an integer part of significant in IEEE754 ...
1
vote
2answers
76 views

Why does little endian apply to numbers and not to text strings?

The Portable Executable file format is the format that Windows EXE files use. It is a binary format. Numbers are in little endian form. Thus, the following hex represents the decimal number 256, not ...
0
votes
3answers
81 views

IEEE754 representation in hexadecimal?

In class, I've heard hexadecimal representation for IEEE754 mentioned and described in 32bit length as a format that consists of one bit for sign, normalized 6-digit fraction (with an implied leading ...
2
votes
1answer
99 views

Overflow rule in two's complement arithmetic

In the book by William Stallings the overflow rule overflow rule for 2's complement addition is stated as follows: Overflow rule: If two numbers are added, and they are both positive or both ...
0
votes
0answers
23 views

Numbers lying between single and double precision

The IEEE floating point number format is defined as $$s\underbrace{c_1\dots c_m}_\text{exponent}\underbrace{f_1\dots f_n}_\text{fraction}\text{ (*)}$$ with $s, c_i, f_j$ being either $1$ or $0$. The ...
1
vote
2answers
56 views

Why can we write almost any nonzero 2-adic integer in the same form?

The title was difficult to formulate (I am open to suggestions). Two things bug me about this: "is almost any" is imprecise, which goes against Volume 1's statement on definiteness. When he writes, "...
1
vote
1answer
32 views

Two's complement max with a different base

Working with fixed size integer representations, use a number system with b-complement notation, base b = 9 and n = 4 digits. What is the smallest number that can be represented in this number system?...
0
votes
1answer
54 views

Why are floats converted from different integers sometimes equal?

I'm trying to understand the following algorithm: ...
3
votes
2answers
38 views

How many unique counting functions there are for strings of N bits?

Let a counting function inc for inputs of N bits be defined as: ...
2
votes
1answer
1k views

Confusion in 2's complement of 00000000

I'm solving the end of the chapter problems of Morris Mano's Digital Design (4th Edition, if that's relevant). In one of the problems, it is asked to simply find the 1's and 2's complement of 00000000....
1
vote
1answer
29 views

What is the range of possible IP addresses when expressed as decimal and hexadecimal?

I know that there are $2^{32}$ different combinations of IPv4 addresses possible , if expressed in binary. In decimal notation, they range from $0.0.0.0$ to $255.255.255.255$. So are there $256^{4}$ ...
4
votes
1answer
84 views

Imaginary numbers and negative zero

I've been studying the low-level hardware implementations of floating point numbers and doing an exercise to design a custom floating point implementation. I know that being able to represent ...
1
vote
4answers
102 views

Float multiplication

While doing the multiplication 1.4*0.8 in a python program, I got the result as 1.1199999999999999. Why didn't I get ...
0
votes
0answers
37 views

IEEE largest number for any machine representation

If we consider a machine that uses 64 bits to represent a number. If 1 bit is used for sign, "x" bits to represent mantissa and (63-x) to store the (biased) exponent in a manner similar to the IEEE ...
1
vote
1answer
170 views

n-bit 2's Complement Conversion

I'm learning 2's complement conversion for positional number systems. For the most part I have only seen 2's complement for represented in 8-bits. I had a discussion with a friend who explained that ...
1
vote
1answer
229 views

$2^1 + 2^2 + \cdots + 2^8$ in binary

Maybe these are silly question. I know almost nothing about computer science, so please let me know in the comment section if I should edit anything or delete it. Let's say I have a function that ...
0
votes
1answer
142 views

-4 as floating point

How would one represent the number -4 as an 8-bit normalised, 2's complement, floating point, with 4 bits dedicated to the exponent? As a normal 4-bit 2's complement number, it would be represented ...
1
vote
1answer
51 views

Smallest number with in a larger number with a certain length

I have a number with $n$ digits. I want to keep only $m$ digits out of it. What is the smallest possible $m$ digit number which can be generated from the larger number so that order of digits is ...
0
votes
1answer
511 views

How to convert a decimal number to ASCII representation [closed]

The question that was in my lecture notes said "Encode the decimal number 2370 in ASCII. " and the answer given there is ...
0
votes
0answers
87 views

How to determine the range of a number represented in IEEE-754 format?

Given a format: say 12-bit floating point with sign bit, 5 - bit biased exponent and 6- bit significant with implied bit, how do i go about determining the range of ...
-1
votes
2answers
181 views

How does the CPU form the binary representation for a number?

More generally, how those translating softwares, for example, an assembler, like nasm, know how to transform in machine code the number "10", from this command: ...
1
vote
2answers
125 views

Why complement of most negative number in octal does not turn out to be itself

I know the range of the $n$ digit numbers in $r$'s complement system is given as $r^{n-1}-1$ to 0 to $-r^{n-1}$. So for 3 bit 2's complement, its: $(2^2-1)$ to $0$ to $-(2^2)$ that is $3$ ...
0
votes
0answers
1k views

Subtraction using 15s complement

I know 15s complement subtraction may not be much taught/popular one, but I just want to give it a try. Just trying to clear my basic digital logic/number systems concepts. Here is what I am doing: ...
4
votes
2answers
111 views

Why aren't numbers stored this way?

I read that the further you get from 0, the less precision, due the way they are stored. So why aren't numbers stored like this: $32$ bits for representing a value between $-2^{31}$ and $2^{31}-1$ ...
1
vote
1answer
283 views

Is there any practical trick to mentally count in Gray code?

When I was fairly young, I taught myself to count in binary. I thought it would be a fun party trick to impress people. I soon found out that it was not. Over the years I've come to appreciate Gray ...
1
vote
3answers
2k views

Why do we need to convert binary numbers into hexadecimal, octal and decimal?

Computer reads binary. Now my question is, what is the use of hexadecimal, octal and decimal? Do Computers understand or can read hexadecimal, octal and decimal? This question remains a mystery for me....
-1
votes
1answer
486 views

Convert between IEEE 754-2008 decimal64 and IEEE double precision floating point number

I need to know the algorithm for converting between IEEE 754-2008 decimal64 and IEEE 754-1985 double precision floating point number. I have been working on this for the past 2 days and I match the ...
1
vote
1answer
590 views

Convert integer of mixed radix to standard positional numeral system and vice versa

I have multiple numbers (e.g. [1, 4, 2]) where each number can be one of a specified range of numbers (e.g. [0-1, 0-5, 0-3]). I ...
3
votes
1answer
1k views

How to work out if an IEEE 754 floating point number is normalized?

How do I tell whether a particular IEEE 754 floating point number is a normalized floating point number? Is there some way to recognize an IEEE 754 normalized floating point number?
7
votes
1answer
122 views

Difference between ways to compare floating-point numbers

There seems to be many approaches to judge whether two floating-point numbers are identical. Here are some examples I've found: ...
1
vote
1answer
45 views

Why do floating point additions sometimes produce equal results? [duplicate]

I have tried two sentences on my computer : 2 + 10^(-18) == 2 2^(-55) + 2^(-57) == 2^(-55) My computer gives TRUE and FALSE respectively. Why does the computer ...
0
votes
1answer
267 views

What happens if we add denormalized number and normalized number?

Denormalized numbers can represent numbers smaller than 2^(-1022) whereas normalized number cannot. So I'm curious what happens if we add denormalized number and normalized number. Actually, I have ...
3
votes
1answer
874 views

Smallest number close to 0 in IEEE754 (64bits)?

I thought the smallest number close to 0 would be : 0 00000000001 (exponent) 0000000000000000000000000000000000000000000000000000 (significand) But this site (http://binaryconvert.com/result_double....
3
votes
2answers
11k 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 ...
2
votes
1answer
498 views

Distribution of IEEE 754 single precision floating point over number line

"What is the maximum and minimum difference between two successive real numbers representable in IEEE 754 Single Precision and Double Precision Floating Point Representations respectively?" In ...
0
votes
3answers
430 views

What is the 1's and 2's complement of 0.01101?

What is the 1's and 2's complement of 0.01101? I'm unable to find any details on this from google. Basically how do we represent the floating points in 1's and 2's complement forms? Even wikipedia ...
2
votes
1answer
6k views

Hex Bit Pattern to IEEE 754 standard Floating Point Number

The question asks for the decimal number that 0x0C000000 represents if it is a floating number. I'm not too sure on how to approach this, but here's my thought process: 0x0C000000 = 0000 1100 0000 ...
2
votes
3answers
3k views

Floating point normalised numbers in binary

Many text books state that for a binary floating point representation in a computer byte, that if the mantissa is normalised, then a positive number must start with 01 from the left or a negative ...
4
votes
2answers
105 views

“Compressing” rationals given error bounds

I'm working on implementing some exact real arithmetic operations for fun. I've got the rough outline of how I want to do things as well and have figured out how to write most of the important ...
2
votes
2answers
264 views

Why is there more frequent overflow in normalised Floating Point

I read that overflow is more frequent when we work with normalised mantissas. Why is this? Is it because when we adopt a normalised representation, our range is smaller than in a unnormalised ...
1
vote
1answer
560 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 ...
1
vote
2answers
76 views

Why is a negative number a pseudo-positive number in ones' complement?

I'm studying ones' complement representation and I read in a book that a negative number in ones' complement is a pseudo-positive of value $R^n - 1 - |x|$. However there is no demostration and I can'...
5
votes
2answers
1k views

How do calculators convert from decimal to fraction?

Sorry if this question is either obvious or ignorant. I am a high school student with only the computer science knowledge I have taught myself. Calculators have a function that can convert numbers ...
1
vote
0answers
47 views

Why have only 15 bits been apportioned for the exponent in the 128-bit quad-precision datatype?

I look forward to the day we can start using quad-precision numbers, but was disappointed to see that in the specification, only 15 bits out of a whopping 128 were assigned to the exponent as shown by ...
1
vote
1answer
341 views

Convert 24(decimal) to modified IEEE 754 floating point format?

Here's what I have as the tweaked format I'm to use: S EEE MMMM (excess 8 format) s = sign bit, E = exponent bits, M = mantissa/fraction bits Otherwise, it follows the IEEE 754 in principle. The ...
2
votes
2answers
3k views

What does normalizing with hidden bit really mean?

I have a question related to representing numbers in base 2 with floating point. For example, if I have such a number $$0.000011 \cdot 2^3$$ then is its normalized form this? $$1.1\cdot 2^{-2}$$ ...
1
vote
1answer
46 views

Normalising fractional numbers

For example $-\tfrac9{16}$. $$\tfrac{9}{16} = \tfrac{1}{16}+\tfrac12 = 0.1001\,,$$ which when normalised becomes $0.1001\times 2^0$. Can its mantissa be $0.0001001$ in 8 bits? If so, as $-\tfrac9{16}...