CSC153 2004S, Class 13: Pause for Breath Admin: * Homework 3 due. * I'll treat the second part as extra credit. * Homework 1 graded. * Homework 2 & 3? to be graded tonight (I hope). * Questions on the exam? * Sam will be unavailable most of the weekend. * How do you get disgusting colors in your program? * Click "check syntax" * Write a scheme->html translator * In spite of what it says on the class outline, no reading for tomorrow. Overview: * Randomness * Some notes on homework 1 * Why is (eq? 0.0 -0.0) false? * They occupy different memory locations. * Pedagogical tool: Use = for comparing numbers. * Assumption: If someone is silly enough to write -0.0, they obviosuly intend something different than 0.0. /Random Lists/ * See random-sum.scm /Notes on Homework 1/ * Please limit your work to seventy or so characters per line. * Try *lots* of test cases. * There seems to be no difference between remainder and modulus (but there is) * Relationship between floor, ceiling, truncate, and round * floor: Find the largest integer less than or equal to its parameter * ceiling: Find the smallest integer greater than or equal to its parameter * (truncate val): "Returns the number to the left of the decimal point" Find the integer whose absolute value is the largest integer less than or equal to the absolute value of val * Wrong: (truncate -2.5) -> 2 * (floor val) if val is positive, (ceiling val) if val is negative * (round val): "Follows standard rounding procedures"; Rounds to the nearest integer. (round 3.5) => 4 (round 2.5) => 3 (nope, 2) * Rounds toward the even. Why?