Java Reference
In-Depth Information
2.Thearithmeticoperationsofaddition,subtraction,multiplication,division,
squareroot,remainder,andcompare
3.Conversionsbetweenintegerandfloating-point,betweenthevariousfloat-
ing-pointformats,andbetweendecimalstringsandfloating-pointformats
4.Handlingoferrorsandexceptions
Thefollowingtopicsarespecificallyexcludedfromthestandard:
1.Decimalandintegerformats
2.Interpretationofthesignandthesignificandfieldsinnon-numeric
encodings(calledNaNs)
3.Binarytodecimalanddecimaltobinaryconversionofnumbersencodedin
theStandard'sextendedformats
Numeric data encoding
IEEE754definesfourfloating-pointencodingsdividedintotwogroups.
Thefirstgroupiscalledthebasicgroupandthesecondoneistheextended
group.Thebasicformatsarespecifiedindetailbythestandard;fortheex-
tendedformats,thestandardlistsonlytheminimumrequirements.Both
groupshaveasingleandadoubleprecisionencoding. Table21-2 showsthe
requirements for the four formats.
Table 21-2
Numeric Data Encodings in IEEE 754
SINGLE
DOUBLE
BASIC
EXTENDED
BASIC
EXTENDED
significand bits
24
32
53
64
maximum exponent
+127
+1023
+1023
+16383
minimum exponent
-126
+1022
-1022
-16382
exponent bias
+127
------
+1023
------
exponent bits
8
11
11
15
total bits
32
43
64
79
Each binary encoding in the IEEE 754 contains three elements or
fields:
1. The first field is the most significant bit and is used to encode the sign of the
number.A1-bitrepresentsanegativenumberanda0bitapositivenumber.
2. The second field is used for encoding the exponent of the number in biased
form. The biased encoding makes it unnecessary to store the exponent
sign. An exponent smaller that the bias is in the negative range. An expo-
nent larger than the bias is in the positive range. The exponent is zero if it is
equal to the bias.
 
Search WWH ::




Custom Search