diff options
author | Yuchen Pei <me@ypei.me> | 2018-01-20 15:41:49 +0100 |
---|---|---|
committer | Yuchen Pei <me@ypei.me> | 2018-01-20 15:41:49 +0100 |
commit | d3a0cc3a8ba6dfeb64d3faeffdeb6845b60e5840 (patch) | |
tree | d58df9ec2480e2a9ec6240f9c797f83d1a0b1056 /projects/12/MathTest/Main.jack | |
parent | 3571f998b28fbc8d9250ba04c983935f10a16c15 (diff) |
rearranged the dir for github
- removed tools and pdfs
- rearranged the projects dirs
- added md files
- other minor changes
Diffstat (limited to 'projects/12/MathTest/Main.jack')
-rw-r--r-- | projects/12/MathTest/Main.jack | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/projects/12/MathTest/Main.jack b/projects/12/MathTest/Main.jack deleted file mode 100644 index de5cec2..0000000 --- a/projects/12/MathTest/Main.jack +++ /dev/null @@ -1,35 +0,0 @@ -// This file is part of www.nand2tetris.org
-// and the book "The Elements of Computing Systems"
-// by Nisan and Schocken, MIT Press.
-// File name: projects/12/MathTest/Main.jack
-
-/** Test program for the OS Math class. */
-class Main {
-
- /** Performs various mathematical operations, using calls to the Math class methods. */
- function void main() {
- var Array r; // stores the test results;
-
- let r = 8000;
-
- let r[0] = 2 * 3; // 6
- let r[1] = r[0] * (-30); // 6 * (-30) = -180
- let r[2] = r[1] * 100; // (-180) * 100 = -18000
- let r[3] = 1 * r[2]; // 1 * (-18000) = -18000
- let r[4] = r[3] * 0; // 0
-
- let r[5] = 9 / 3; // 3
- let r[6] = (-18000) / 6; // -3000
- let r[7] = 32766 / (-32767); // 0
-
- let r[8] = Math.sqrt(9); // 3
- let r[9] = Math.sqrt(32767); // 181
-
- let r[10] = Math.min(345, 123); // 123
- let r[11] = Math.max(123, -345); // 123
- let r[12] = Math.abs(27); // 27
- let r[13] = Math.abs(-32767); // 32767
-
- return;
- }
-}
|