Floating point constants, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 49

Advertising
background image

Binary Constants

All constants starting with

0b

(or

0B

) are taken to be binary. In the absence of any

overriding suffixes, the data type of an binary constant is derived from its value,
according to the rules presented above. For example,

0b11101

will be treated as

short

.

Octal Constants

All constants with an initial zero are taken to be octal. If an octal constant contains
the illegal digits 8 or 9, an error is reported. In the absence of any overriding suf-
fixes, the data type of an octal constant is derived from its value, according to the
rules presented above. For example,

0777

will be treated as

int

.

Floating Point Constants

A floating-point constant consists of:

- Decimal integer,
- Decimal point,
- Decimal fraction,
-

e

or

E

and a signed integer exponent (optional),

- Type suffix:

f

or

F

or

l

or

L

(optional).

You can omit either the decimal integer or the decimal fraction (but not both). You
can omit either the decimal point or the letter

e

(or

E

) and the signed integer expo-

nent (but not both). These rules allow for conventional and scientific (exponent)
notations.

Negative floating constants are taken as positive constants with the unary operator
minus (

-

) prefixed.

mikroC limits floating-point constants to range

±1.17549435082E38 .. ±6.80564774407E38

.

mikroC floating-point constants are of type

double

. Note that mikroC’s imple-

mentation of ANSI Standard considers

float

and

double

(together with the

long double

variant) to be the same type.

MikroElektronika: Development tools - Books - Compilers

41

page

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

Advertising
This manual is related to the following products: