
vii
SC
Table of Contents
Preface
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
xix
1. Numbers and Enumerations
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
1.1 Determining Approximate Equality Between a Fraction
and Floating-Point Value 3
1.2 Converting Degrees to Radians 4
1.3 Converting Radians to Degrees 5
1.4 Using the Bitwise Complement Operator with Various Data Types 6
1.5 Testing for an Even or Odd Value 7
1.6 Obtaining the High Word or Low Word of a Number 8
1.7 Converting a Number in Another Base to Base10 10
1.8 Determining Whether a String Is a Valid Number 11
1.9 Rounding a Floating-Point Value 12
1.10 Choosing a Rounding Algorithm 12
1.11 Converting Celsius to Fahrenheit 13
1.12 Converting Fahrenheit to Celsius 14
1.13 Safely Performing a Narrowing Numeric Cast 14
1.14 Finding the Length of Any Three Sides of a Right Triangle 17
1.15 Finding the Angles of a Right Triangle 19
1.16 Displaying an Enumeration Value as a String 20
1.17 Converting Plain Text to an Equivalent Enumeration Value 22
1.18 Testing for a Valid Enumeration Value 23
1.19 Testing for a Valid Enumeration of Flags 25
1.20 Using Enumerated Members in a Bit Mask 27
1.21 Determining if One or More Enumeration Flags Are Set 30
1.22 Determining the Integral Part of a Decimal or Double 33