NAND

Actionscript:
  1. var a:int, b:int;
  2.  
  3. a = 0;
  4. b = 0;
  5.  
  6. trace(int(!(a & b)));
  7.  
  8. a = 0;
  9. b = 1;
  10.  
  11. trace(int(!(a & b)));
  12.  
  13. a = 1;
  14. b = 0;
  15.  
  16. trace(int(!(a & b)));
  17.  
  18. a = 1;
  19. b = 1;
  20.  
  21. trace(int(!(a & b)));
  22.  
  23. /*
  24. outputs:
  25. 1
  26. 1
  27. 1
  28. 0
  29. */
  30.  
  31. /*
  32. NAND
  33. 00    1
  34. 01    1
  35. 10    1
  36. 11    0
  37. */

I started reading "The Elements of Computing Systems: Building a Modern Computer from First Principles" By Noam Nisan and Shimon Schocken. So far it's a very fun read. They talk about the power of NAND in the first chapter....

This entry was posted in Operators, misc and tagged , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*