commit 03a166d2a1fc9f28909693c12143f9079ffccf10
parent 651ef4df251fcd9f599f02f1c3a152c5aeb62abf
Author: glenda <glenda@cirno>
Date: Mon, 16 Feb 2026 15:25:06 +0000
"comparing
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/CS10720/16.02.26.md b/CS10720/16.02.26.md
@@ -2,4 +2,14 @@
## comparing integers
--
+- for normal rep, all is normal, loop through all the bits
+
+- for SM, check if the sign bit is set, if it is, then use normal
+- if both sign bits are the same, then do normal, but return the opposite of the expected result
+- if they have different signs, then use the sign bit to compare, and dont forget to check the double 0
+
+- for 1's comp. you can use normal rep algo, if both sign bits are the same
+- if the sign bits are different, you can use the sign bit to check which is larger
+- don't forget the double 0
+
+- for 2's comp. same as 1's comp. but no worry for the doube 0