# C Floating-Point Constants

A "floating-point constant" is a decimal number that represents a signed real number. The representation of a signed real number includes an integer portion, a fractional portion, and an exponent. Use floating-point constants to represent floating-point values that can't be changed.

## Syntax

* floating-point-constant*:

`fractional-constant`

`exponent-part`

_{opt}

`floating-suffix`

_{opt}

`digit-sequence`

`exponent-part`

`floating-suffix`

_{opt}

* fractional-constant*:

`digit-sequence`

_{opt}

**.**

`digit-sequence`

`digit-sequence`

**.**

* exponent-part*:

**e**

`sign`

_{opt}

`digit-sequence`

**E**

`sign`

_{opt}

`digit-sequence`

* sign*: one of

`+`

`-`

* digit-sequence*:

`digit`

`digit-sequence`

`digit`

* floating-suffix*: one of

`f`

`l`

`F`

`L`

You can omit either the digits before the decimal point (the integer portion of the value) or the digits after the decimal point (the fractional portion), but not both. You may leave out the decimal point only if you include an exponent. No white-space characters can separate the digits or characters of the constant.

The following examples illustrate some forms of floating-point constants and expressions:

```
15.75
1.575E1 /* = 15.75 */
1575e-2 /* = 15.75 */
-2.5e-3 /* = -0.0025 */
25E-4 /* = 0.0025 */
```

Floating-point constants are positive unless they're preceded by a minus sign (** -**). In this case, the minus sign is treated as a unary arithmetic negation operator. Floating-point constants have type

**,**

`float`

**, or**

`double`

**.**

`long double`

A floating-point constant without an ** f**,

**,**

`F`

**, or**

`l`

**suffix has type**

`L`

**. If the letter**

`double`

**or**

`f`

**is the suffix, the constant has type**

`F`

**. If suffixed by the letter**

`float`

**or**

`l`

**, it has type**

`L`

**. For example:**

`long double`

```
10.0L /* Has type long double */
10.0 /* Has type double */
10.0F /* Has type float */
```

The Microsoft C compiler internally represents ** long double** the same as type

**. However, the types are distinct. See Storage of basic types for information about type**

`double`

**,**

`double`

**, and**

`float`

**.**

`long double`

You can omit the integer portion of the floating-point constant, as shown in the following examples. The number 0.75 can be expressed in many ways, including the following examples:

```
.0075e2
0.075e1
.075e1
75e-2
```

## See also

## Feedback

Submit and view feedback for