show_nitty_gritty

Show_nitty_gritty - CHAPTER 2 “Simple” C Programs The Nitty-Gritty Reading Assignment Read the math function descriptions §2.8 pp 61–66

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CHAPTER 2 “Simple” C++ Programs The Nitty-Gritty March 28, 2008 Reading Assignment Read the math function descriptions §2.8, pp 61–66. Nitty-Gritty Variables, Identifiers, Types Variables Fundamental types (everything except string ) have random values if they are not initialized when declared. 1 i n t I n t e g e r ; 2 d o u b l e Double ; 3 s t r i n g S t r i n g ; 4 5 c o u t << "Integer=" << I n t e g e r << e n d l ; 6 c o u t << "Double=" << Double << e n d l ; 7 c o u t << "String=’" << S t r i n g << "’" << e n d l ; Integer=0 Double=0 String=’’ RUN EDIT garbage_variables.cxx Variable Names ∼ Identifiers Nitty-Gritty Variables, Identifiers, Types Beware the Reserved Words asm auto break case catch char class const continue default delete do double else enum extern float for friend goto if inline int long new operator private protected public register return short signed sizeof static struct switch template this throw try typedef union unsigned virtual void volatile while Nitty-Gritty Variables, Identifiers, Types Fundamental Type Specifiers Values for Intel PC 32b Architectures Type Specifier Bytes (Bits) Negative Range Positive Range bool 1 (1)-- 1 char 1 (8)-128-- 127 unsigned char 1 (8)-- 255 short 2 (16)-32,768-- 32,767 unsigned short 2 (16)-- 65,535 ( int ) long 4 (32)-2,147,483,648-- 2,147,483,647 unsigned long 4 (32)-- 4,294,967,295 float 8 (64)- 3 . 4028 × 10 38-- 1 . 1755 × 10- 38 1 . 1755 × 10- 38- 3 . 4028 × 10 38 long double 16 (128)- 2 . 2251 × 10 308-- 1 . 7977 × 10- 308 1 . 7977 × 10- 308- 2 . 2251 × 10 308 float s and double s may also be zero. float s have 6 digits of decimal precision (6 significant digits) double s have 15 digits of decimal precision (15 significant digits) On a 64b machine, a signed int ranges through [- 9223372036854775808 , 9223372036854775807 ] Nitty-Gritty Computation Headaches ℜ Underflow & Overflow Type Specifier Positive Range double 1 . 7977 × 10- 308- 2 . 2251 × 10 308 Underflow : You cannot compute 1 . × 10- 308 10 = 1 × 10- 309 Overflow : You cannot compute 10 ˙ ( 2 × 10 308 ) = 2 × 10 309 Nitty-Gritty Computation Headaches Integer Computations Type Specifier Positive Range...
View Full Document

This note was uploaded on 04/07/2008 for the course CSCI 261 taught by Professor Hellman during the Spring '08 term at Mines.

Page1 / 24

Show_nitty_gritty - CHAPTER 2 “Simple” C Programs The Nitty-Gritty Reading Assignment Read the math function descriptions §2.8 pp 61–66

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online