lecture04-jan27 - EE312 Lecture 4 Announcements Assignment...

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

View Full Document Right Arrow Icon
1/27/10 1 EE312 - Lecture 4 Announcements • Assignment 1 – Due tomorrow – Upload your .c file, attach the file, then submit • Read Chapters 5 and 6 for next week • Topics for today will address: – Integer literals – Floating point numbers – Start formatted input and output (Ch. 3) Remember – you think in decimal but the computer thinks in binary Integer Literals • These are numeric values that cannot be altered during program execution • They may appear in one of three formats: – decimal (base 10, digits 0-9, must not begin with 0 ) • 15, 255, 32767 – hexadecimal (base 16, digits 0-9,a-f – must begin with 0x ) • 0xf, 0xfF, 0xFFF • hexadecimal digits may be in upper or lower case, 0xFf or 0xff or 0xFF – octal (base 8, digits 0-7, must begin with 0 ) • 017, 0377, 077777 • Hex is mostly used in low level programs What happens if I put a 0 in front of a decimal #? 057 058 Integer Literals (cont) • All forms (decimal, octal, hex) are all represented (internally) the same (i.e. In binary) 10 + 015 + 0x20 ??? Answer is 55 (in decimal) • Representation Rules – if literal value falls within int type range int • otherwise it’s a long int – To force long or unsigned representation, follow the literal with a U and/or L – For examples • 15U 0377L 0x7ffffffffUL Floating Point (real) • Capable of representing fractional numbers • Numbers are stored in 3 parts: – Sign bit ( + / -) – Exponent ( 10 n , number of bits size) – Fraction (number of bits precision) • Three floating point formats are: float single precision double double precision long double extended precision • Nearly all engineering calculations should
Background image of page 1

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

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

Page1 / 3

lecture04-jan27 - EE312 Lecture 4 Announcements Assignment...

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

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