beautypg.com

Rounding, Non-ieee-754 standard format, Rounding -15 – Altera Floating-Point User Manual

Page 21: Non-ieee-754 standard format -15, Sign bit integer bits 31 0

background image

Meaning

Sign Field

Exponent Field

Mantissa Field

Negative Denormalized

1

All 0’s

Non-zero

Positive Infinity

0

All 1’s

All 0’s

Negative Infinity

1

All 1’s

All 0’s

Not-a-Number (NaN)

Don’t care

All 1’s

Non-zero

Rounding

The IEEE-754 standard defines four types of rounding modes, which are:
• round-to-nearest-even

• round-toward-zero

• round-toward-positive-infinity

• round-toward-negative-infinity
Altera floating-point IP cores support only the most commonly used rounding mode, which is the round-

to-nearest-even mode (

TO_NEAREST

). With round-to-nearest-even, the IP core rounds the result to the

nearest floating-point number. If the result is exactly halfway between two floating-point numbers, the IP

core rounds the result so that the LSB becomes a zero, which is even.

Non-IEEE-754 Standard Format

Only the ALTFP_CONVERT and ALTERA_FP_FUNCTIONS (when the convert function is selected)

support the fixed point format.
The fixed-point data type is similar to the conventional integer data type, except that the fixed-point data

carries a predetermined number of fractional bits. If the width of the fraction is 0, the data becomes a

normal signed integer.
The notation for fixed-point format numbers in this user guide is Qm.f, where Q designates that the

number is in Q format notation, m is the number of bits used to indicate the integer portion of the

number, and f is the number of bits used to indicate the fractional portion of the number.
For example, Q4.12 describes a number with 4 integer bits and 12 fractional bits in a 16-bit word.
The following figures show the difference between the signed-integer format and the fixed-point format

for a 32-bit number.

Figure 1-11: Signed-Integer Format

Sign

bit

Integer bits

31

0

UG-01058

2014.12.19

Rounding

1-15

About Floating-Point IP Cores

Altera Corporation

Send Feedback