CS 1112 Lecture Notes - Lecture 2: Double-Precision Floating-Point Format

36 views2 pages

Document Summary

To get input: var = input("enter whatever: "); pi is a built in variable. Trig functions are built-in (using radians) functionname(argument, argument, etc) Script execution: a sequence of statements in an m-file A variable is a finite named computer memory space for storing a value. Must start with a letter but can contain digits. By default a number is a double, not an int. Double precision refers to how much memory is used (64 bits) Doubles can be casted to ints to use less memory. Value can be displayed using layout option with types/class/bytes/etc (see options) Assignment is putting a value into a variable (operator: =) Ex. r=2*4+5 (read: r gets 2 times 4 plus 5) Right hand side evaluated first then assigned to left. Variables must be defined and initialized before they can be referenced. Also fprintf("id %f inches\n", x) with if needed many variables. "\n" is the escape sequence for new line.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents