{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

P.Lecture - 1.22.08

# P.Lecture - 1.22.08 - Announcements Blackboard Discussion...

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

Announcements Blackboard Discussion Avoid emailing your TAs with questions about assignments/lectures Course Communication Groups Opt out by today 5pm Opt out by today 5pm For today: Finish floating point numbers Formatted I/O

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

View Full Document
FloatingPoint 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 use d bl l d bl double or long double
FloatingPointLiterals 57.0 57. 57.0e0 5.7e+1 .57e2 570.e 1 Must contain decimal point and/or exponent By default stored as double precision numbers F or f, L or l can be used to force storage format IEEE Standard 754 Floating Point Characteristics Type Smallest Value (+) Largest Value (+) Precision float (32) 1 17x10 38 3 40x10 38 Up to 6 digits 1.17x10 3.40x10 double (64) 2.22x10 308 1.79x10 308 Up to 15 digits long double is not defined by this standard and is usually 80 or 128 bits

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

View Full Document
CMathLibraryFunctions See Ch. 23.3 and appendix D #include <math.h> Trig functions Hyperbolic functions Exponential functions Logarithmic functions Power functions N i Nearest integer Absolute value Remainder functions Functions are called by name ( values passed ), e.g., d bl double x; x = sqrt (3.0); /* x will be 1.73205 */
Formatted Input and Output For simplifying the process of inputting values into and out of your program while its running stdio library contains functions for: reading values from the keyboard (the standard input device): scanf() writing out values to the screen (the standard output device) printf() Rely on provided format specification You may use these in your assignments Input d i values Your program running on the values Output d i device computer device

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

View Full Document
printf() function printf ( “ format string in quotes ”, list of values ); Defined in a library. Declared in <stdio.h> printf ("Double % d is % d \n", x, 2 * x );
Escape Sequences Format string sometimes needs to contain control characters (such as tab and newline)

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 22

P.Lecture - 1.22.08 - Announcements Blackboard Discussion...

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

View Full Document
Ask a homework question - tutors are online