Questions tagged [number-formats]

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

Filter by
Sorted by
Tagged with
37
votes
6answers
56k views

The math behind converting from any base to any base without going through base 10?

I've been looking into the math behind converting from any base to any base. This is more about confirming my results than anything. I found what seems to be my answer on mathforum.org but I'm still ...
20
votes
7answers
9k views

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

Consider a fixed point representation which can be regarded as a degenerate case of a floating number. It is entirely possible to use 2's complement for negative numbers. But why is a sign bit ...
10
votes
9answers
3k views

Represent a real number without loss of precision

Current floating point (ANSI C float, double) allow to represent an approximation of a real number. Is there any way to represent real numbers without errors? Here's an idea I had, which is anything ...
8
votes
5answers
4k views

Using base 80 for compressing files

I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnt that Hexadecimal uses symbols like A, B, C, ...
7
votes
1answer
154 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: ...
6
votes
1answer
2k views

Confused by Floating Point Spacing

I'm currently taking a numerical analysis class in college and we're covering floating point systems. For the most part, I have a good grasp on it. However, something I can't seem to visualize, and ...
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 ...
4
votes
2answers
113 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$ ...
4
votes
2answers
108 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 ...
4
votes
2answers
14k 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 ...
4
votes
1answer
105 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 ...
3
votes
3answers
4k 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}$$ ...
3
votes
1answer
249 views

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

It seems like it would be possible to add more precision to the IEEE 32-bit mantissa system if the leading zeroes were also dropped, just like the leading 1 is dropped due to it being implicitly known....
3
votes
2answers
114 views

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

From the Wikipedia page on the IEEE Standard for Floating-Point Arithmetic, The possible finite values that can be represented in a format are determined by the base (b), the number of digits in ...
3
votes
2answers
104 views

How much can we trust mathematical software when working with large numbers, and how much memory it needs to work with these numbers?

For example, I want to evaluate the expression: $3^{3^{{3}^{3}}}$ so I used wolframalpha.com (it's free, and I don't own any software), which returned the scientific notation of the number above, ...
3
votes
1answer
2k 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
41 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
3answers
4k 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 ...
2
votes
1answer
72 views

Repeated addition and comparisons of floating point numbers

In the following program where I repeatedly half an integer, it takes until i = 1074 for my integer to be equal to zero (I know that ideally the while loop shouldn'...
2
votes
2answers
498 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 ...
2
votes
3answers
999 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 ...
2
votes
1answer
606 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 ...
2
votes
1answer
7k 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
1answer
369 views

Maximum single-precision floating-point format number

According to this wikipedia article the maximum single precision is 7f7fffff. Can some explain me why it is (7f7fffff)16 and not (7fffffff)16? (7f7fffff)16 = (0111 1111 0111 1111 1111 1111 1111 1111)...
2
votes
1answer
2k 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 ...
2
votes
1answer
2k 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?
2
votes
2answers
294 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 ...
2
votes
2answers
955 views

Implicit Leading 1 in Binary Floating Point

Is the convention of dropping the leading 1 when storing the significand a given in all binary floating point representations or not necessarily?
2
votes
1answer
2k 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....
2
votes
3answers
616 views

Can a unnormalized floating point number be recognized also when exponent is not zero?

From Tanebaum's Structed Computer Organization. Exercise 4 of Appendix B The following binary floating-point number consist of a sign bit, an excess $64$, radix $2$ exponent, and a $16$-bit ...
1
vote
2answers
65 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
3answers
3k 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
vote
4answers
71 views

How does a computer compute negative(-) and positive(+) Infinity?

If we divide (1.0/0.0) we will get +Infinity and if we divide (-1.0/0.0) we will get -Infinity. How does a computer calculate this value internally?
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 ...
1
vote
1answer
7k views

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

For a rational number 1/3 below is the floating point representation(64 bit) of decimal expansion 0.3333333.... As per the above bit structure, I would like to ...
1
vote
2answers
46 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
29 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, ...
1
vote
4answers
316 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 ...
1
vote
1answer
776 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 ...
1
vote
1answer
713 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
81 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'...
1
vote
1answer
431 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 ...
1
vote
1answer
94 views

Positional number representation

There is a definition of integer representation: A positional representation for integers that uses the binary digits 0 and 1, in which the values represented by successive bits are additive, ...
1
vote
2answers
49 views

What needs led to the implementation of ASCII codes?

Prior to ASCII existing, we already had at least four number systems, namely Binary Decimal Octal Hexadecimal So what were the needs that lead to the ...
1
vote
1answer
36 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}$ ...
1
vote
1answer
223 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
231 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 ...
1
vote
1answer
66 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 ...
1
vote
1answer
51 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}...
1
vote
1answer
72 views

Why is the precision of floating point numbers worse for smaller numbers?

Why is the machine error/epsilon higher between a pair of two lower numbers than a pair of two high numbers? For example, between the two smallest numbers possible in 5 bit mantissa and the two ...