This action might not be possible to undo. Are you sure you want to continue?

uk

The Representation of Real Numbers on a Computer

Most computation is carried out using real or ‘floating point’ numbers. We regularly use ‘large’

numbers (for example the speed of light 2.997924591 x 10

8

metres per second

1

) and ‘small

numbers (for example the charge on an electron is -1.6⨉10

-19

coulombs

2

). Computers work on

pulses between electrical components and its state is taken to be off or on. Hence numbers on a

computer are represented using the binary system

3

.

The floating point representation of numbers in using the binary system is similar to standard

index form

4

. For example with 2.997924591 x 10

8

the ‘2.997924591’ is the mantissa and the ‘8’

is the exponent and with -1.6⨉10

-19

the ‘-1.6’ is the mantissa and the ‘-19’ is the exponent. A

floating point number on a computer has the form

̅

**where m is the mantissa and e is the exponent. Each digit of m and e are stored in binary. A
**

floating point number is stored on a computer in a number of bytes and each byte stores eight

bits. For example typical modern computer programming languages such as c or Java store a

floating point number in either 4 bytes (called a float) or 8 bytes (called a double)

5

.

The following diagram illustrates how a float is stored in 4 bytes or 32 buts.

sign (1 bit) exponent (8 bit) absolute value of the mantissa

The sign of the mantissa is either ‘+’ or ‘-‘ and hence this can be stored in one bit. The exponent

is stored in eight bits and the modulus of the mantissa is stored in 23 bits.

Let us consider an example of converting a real number in decimal format

6

and convert it to a 4

byte float in the format above. Starting with a number like 13.875, the first step is to change it to

binary. Using the spreadsheet

7

, we find that 13.87510 = 1101.1112. The convention is to write

this in the form 1.101111 ⨉ 2

3

, so that the 23 bit mantissa is 1.10111100000000000000. The

exponent ‘3’ is stored as 127+3=130 in base 10, so the eight bit exponent is 10000010 (Note

that eight bits can represent 0-255 and the exponent can be negative so the mid-point of 127 is

aligned to zero). The sign bit is 0 to represent that the number is positive.

In summary, 13.875 is represented as

0 1 0 0 0 0 0 1 0 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

.

1

Electromagnetic Radiation

2

The Discovery of the Nuclear Atom

3

Binary Representation of Numbers

4

Standard Index Form

5

Space and Time

6

Decimal Representation of Numbers

7

Change of Base – Excel Spreadsheet

www.computing.me.uk

The smallest number that is greater than 13.875 that can also be represented by this method is

1.1011110000000000000001 ⨉ 2

3

= 13.8750019… The largest number that is less than 13.875

that can also be represented by this method is 1.1011101111111111111110 ⨉ 2

3

=

13.8749981… . Let us illustrate these numbers on the real number line in the following diagram.

13.8749981… 13.875 13.8750019…

Hence the number 13.875 (like most real numbers) cannot be stored exactly as a float (or in any

other precision. It can only best be stored by as either 13.879981…. or 13.8750019…, the two

closest numbers that can be represented by the computer as a float . The difference between the

actual number and the value of its representation on a computer is called round-off error.

The maximum value that can be stored in float format is

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

or ±1.111111111111111111112⨉2

127

≈ 2

128

≈ 3.4⨉10

38

.

The minimum possible value that can be stored in float format is

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1

or ±0.00000000000000000000012⨉2

-127

≈ 2

-149

≈ 1.4⨉10

-45

, but the actual minimum value is

based on the implementation.

- GLS_T.FOR
- gls.xls
- REGLS.FOR
- GLS.FOR
- regls_bas
- gls_bas
- Numerical Solution of a General Linear System of Equations.pdf
- Computation of the Discrete Forms of the Laplace Integral Operators
- Representation of an Axisymmetric Surface by Conical Panels
- Representation of a Surface by Triangular Panels
- Boundary Representation in the Boundary Element Method
- Representation of a 2D Line by Straight Line Elements
- Outline of the Boundary Element Method
- Discretization of the Laplace Integral Operators
- The Laplace Integral Operators
- Geometry codes in matlab
- GEOM3D.FOR User Guide
- GEOM2D.FOR User Guide
- GEOM.xlsm User Guide
- glt7tests.bas
- gl8tests.bas
- glt7.bas
- gl8.bas
- GLT7TESTS.FOR
- GLT7.FOR

The Representation of Real Numbers on a Computer

The Representation of Real Numbers on a Computer

- Discrete Maths 2002 Lecture 07 3 Slides Pp
- Discrete Maths 2003 Lecture 07 3 Slides Pp
- NUMERICAL CODING SYSTEMS
- Fault-Tolerant Quantum Computation - 9712048v1
- Lecture 2
- Boundary Element Methods for Engineers_ Part I_071
- O-Hamming
- omni 3000_6000 modbus database 4B.pdf
- Fun With Bits _ Print All Subsets of a Set _ HackerEarth
- Bit Overflow
- Article 2 Binary Numbers
- Bitwise Operators
- Bigendian Small Endian
- Decodor Uhlenbrock 76400
- COA Karthik 2
- iii change extarnal internal.docx
- Bits Bytes
- Coding Systems
- Floating Point Numbers
- Hamming Codes
- A soft-error tolerant content-addressable memory (CAM) using an error-correcting-match scheme
- Ch 8 95 [RRead-Only] [Compatibility Mode]
- Bit-Level Binaries and Generalized Comprehensions in Erlang
- CCP105
- Home 2
- error analysis of floating point dot products
- Comp Sci - IJCSEITR - A Prototype - Vishnu Mishra-ALL 6
- Computingtytyt
- Framing
- Bit Manipulation
- The Representation of Real Numbers on a Computer

Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

We've moved you to where you read on your other device.

Get the full title to continue

Get the full title to continue reading from where you left off, or restart the preview.

scribd