Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 683

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

12 votes

Why is 2s complement of 000 equal to 111, but 9s complement of 000 is not 888?

The two's complement of 000 is 000. It is formed by complementing all bits and adding 1 to the result. The one's complement of 000 is indeed 111, but it is not used in computing. The ten's complement …
Yuval Filmus's user avatar
2 votes
Accepted

Show that only a few multiples of .01 decimal are powers of 2

Hint: The four values are $25/100 = 1/4$ and its multiples. If all you want to do is store an exact amount of currency, you can use an integer which represents the amount of cents. (This is known as …
Yuval Filmus's user avatar
3 votes

Maximum single-precision floating-point format number

The second exponent is FF, which signals NaN according to Wikipedia, and so the highest exponent is only FE. This is verified by the following C code snippet: unsigned int i = 0x7FFFFFFF; float f = * …
Yuval Filmus's user avatar
0 votes
Accepted

How to convert a decimal number to ASCII representation

The ASCII encodings for digits 0 to 9 are 48 to 57 in decimal, or 30 to 39 in hexadecimal.
Yuval Filmus's user avatar
3 votes

Floating point format: why must `1−emax ≤ q+p−1 ≤ emax`?

The reason we get a larger range is denormalized numbers. Generally speaking, floating point numbers have three physical parts: sign (1 bit), mantissa $M$ and exponent $e$. Most of the time we think o …
Yuval Filmus's user avatar
1 vote

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

You are asking two questions: How can I prove that negative numbers are stored as pseudopositive? Why are negative numbers stored as pseudopositive? The answer to the first question is that no pro …
Yuval Filmus's user avatar
3 votes

Distribution of IEEE 754 single precision floating point over number line

The idea is that a (not denormalized) floating point number is stored as $2^x \times 1.m_0 \ldots m_{k-1}$ (in binary), where $x$ is the exponent and $m_0 \ldots m_{k-1}$ is the mantissa of length $k$ …
Yuval Filmus's user avatar
6 votes
Accepted

Can we improve the precision of IEEE floats by dropping leading zeros in the mantissa?

If you drop the leading zeroes then $3,5,9,17$ and so on will all have the same representation. Don't forget that the number being represented need not be an integer.
Yuval Filmus's user avatar
4 votes
Accepted

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

It's not true that when all components of the exponent are 0 then the number must represent 0. A (normalized) floating point number is composed of two parts: sign, exponent, and mantissa. The value of …
Yuval Filmus's user avatar
1 vote

What is the 2's complement answer of 16.5?

It seems that WolframAlpha is using fixed-point representation. In effect, it is doubling your number and then representing it as two's-complement. In more detail, WolframAlpha is guessing that you a …
Yuval Filmus's user avatar
4 votes
Accepted

Interpretation of '1/3' in IEEE floating point representation

The fractional part is in binary: $(0.01010101\ldots)_2 = (0.333333\ldots)_{10}$. To convince yourself of this, try multiplying the binary $0.0101010101\ldots$ by $3$: you will get $0.111111\ldots = 1 …
Yuval Filmus's user avatar
1 vote

Float multiplication

The other answers explain why you're not getting 1.12 exactly (in brief, this is because floating point numbers can only exactly represent rationals whose denominator is a power of 2). The result of …
Yuval Filmus's user avatar
1 vote
Accepted

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

Suppose that a set of functions $F_0,\ldots,F_{N-1}$ satisfies the constraints, generating the sequence $x_0 = 0^N, x_1, \ldots, x_{2^{N-1}-1}$. When does a function $F_N$ satisfy the constraints? If …
Yuval Filmus's user avatar
2 votes

Prove every number in double precision 32-bit floating-point format can be represented in 64...

Ignoring denormalized numbers, infinities and the like, floating point formats can store numbers of the form $$ \pm \left(1 + \frac{x}{2^N}\right) \times 2^y, $$ where $0 \leq x < 2^N-1$ and $-M \leq …
Yuval Filmus's user avatar
7 votes

Why floating point representation uses a sign bit instead of 2's complement to indicate nega...

Two's complement makes sense when the two entities in question have the same "units" and the same "width". By width I mean that, say, if you're adding an N bit number and an M bit number, where N and …
Yuval Filmus's user avatar

15 30 50 per page