Atmel CAVR-4 Manual De Usuario
CAVR-4
258
Descriptions of implementation-defined behavior
AVR® IAR C/C++ Compiler
Reference Guide
INTEGERS
Range of integer values (6.1.2.5)
The representation of integer values are in the two's complement form. The most
significant bit holds the sign; 1 for negative, 0 for positive and zero.
significant bit holds the sign; 1 for negative, 0 for positive and zero.
See Basic data types, page 138, for information about the ranges for the different integer
types.
types.
Demotion of integers (6.2.1.2)
Converting an integer to a shorter signed integer is made by truncation. If the value
cannot be represented when converting an unsigned integer to a signed integer of equal
length, the bit-pattern remains the same. In other words, a large enough value will be
converted into a negative value.
cannot be represented when converting an unsigned integer to a signed integer of equal
length, the bit-pattern remains the same. In other words, a large enough value will be
converted into a negative value.
Signed bitwise operations (6.3)
Bitwise operations on signed integers work the same way as bitwise operations on
unsigned integers; in other words, the sign-bit will be treated as any other bit.
unsigned integers; in other words, the sign-bit will be treated as any other bit.
Sign of the remainder on integer division (6.3.5)
The sign of the remainder on integer division is the same as the sign of the dividend.
Negative valued signed right shifts (6.3.7)
The result of a right-shift of a negative-valued signed integral type preserves the sign-bit.
For example, shifting
For example, shifting
0xFF00
down one step yields
0xFF80
.
FLOATING POINT
Representation of floating-point values (6.1.2.5)
The representation and sets of the various floating-point numbers adheres to IEEE
854–1987. A typical floating-point number is built up of a sign-bit (
854–1987. A typical floating-point number is built up of a sign-bit (
s
), a biased
exponent (
e
), and a mantissa (
m
).
See Floating-point types, page 139, for information about the ranges and sizes for the
different floating-point types:
different floating-point types:
float
and
double
.
Converting integer values to floating-point values (6.2.1.3)
When an integral number is cast to a floating-point value that cannot exactly represent
the value, the value is rounded (up or down) to the nearest suitable value.
the value, the value is rounded (up or down) to the nearest suitable value.