Floating Point Constants :
A floating point constant is a base-10 number that contains either a decimal point or an exponent or both. A floating point constant can be written in two forms: Factorial form or Exponential form. A floating-point constant in a fractional form must have at least one digit each to the left and right of the decimal point. A floating-point in exponent form consists of a mantissa and an exponent. The mantissa itself is represented as a decimal integer constant or a decimal floating-point constant in fractional form. The letter E or e and the exponent follow the mantissa. The exponent must be a decimal integer. The actual number of digits in the mantissa and the exponent depends on the computer being used.
The following are valid floating-point constants.</1.0 0.1 2E-4 -0.1555e-4
The following floating-point constants are written incorrectly for the reasons stated.written incorrectly for the reasons stated.
1 No decimal point or exponent.
2,00.8 Illegal character (,).
2 E+10.20 Exponent must be an integer.
3 E10 Illegal character (space).
C – FLOATING POINT CONSTANT EXAMPLE PROGRAM :
const float a = 2E-4;
printf(“Value of a =%e”,a);
|Value of a = 2.000000e-04|