Wednesday, June 2, 2010

Floating point Types

float 4 bytes (7 significant decimal digits)
double 8 bytes (15 significant decimal digits)

The name double refers to the fact that these numbers have twice the precision of the float type. (double-precision). Most applications choose double. the only reaons to use float are in the rare situation in which the slightly faster processing of single-precision numbers is important.

float have a suffix F 3.402F

floating point numbers without an F suffix are always considered to be of type double. you can optionally suppfly suffix D

SE5.0 0x1.0-3 = 0.125 (floating point in hexadecimal)

three special floating point values to denote overflows and errors
Double.POSITIVE_INFINITY
DOUBLE.NEGATIVE_INFINITY
DOUBLE.NaN( not a number)

ALL 'not a number' values are considered distinct.

No comments:

Post a Comment