diff options
author | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
---|---|---|
committer | Perry Hung <iperry@gmail.com> | 2011-01-24 23:23:29 -0500 |
commit | c48689d34809943a5907884bd287cea9ae275352 (patch) | |
tree | d49ff06b0d4b81f6ab0eac8060d178ce7542476c /docs/source/arduino/int.rst | |
parent | 64431fd4b59cb8656365f1fad5f679cd4d756239 (diff) | |
parent | a9b2d70bc7799ca96c1673b18fe3012b1a4dd329 (diff) | |
download | librambutan-c48689d34809943a5907884bd287cea9ae275352.tar.gz librambutan-c48689d34809943a5907884bd287cea9ae275352.zip |
Merge remote branch 'leaf/master'
Diffstat (limited to 'docs/source/arduino/int.rst')
-rw-r--r-- | docs/source/arduino/int.rst | 84 |
1 files changed, 0 insertions, 84 deletions
diff --git a/docs/source/arduino/int.rst b/docs/source/arduino/int.rst deleted file mode 100644 index 2bb3bef..0000000 --- a/docs/source/arduino/int.rst +++ /dev/null @@ -1,84 +0,0 @@ -.. _arduino-int: - -int -=== - -Description ------------ - -Integers are your primary datatype for number storage, and store a -2 byte value. This yields a range of -32,768 to 32,767 (minimum -value of -2^15 and a maximum value of (2^15) - 1). - - - -Int's store negative numbers with a technique called -`2's complement math. <http://en.wikipedia.org/wiki/2's_complement>`_ -The highest bit, sometimes refered to as the "sign" bit, flags the -number as a negative number. The rest of the bits are inverted and -1 is added. - - - -The Arduino takes care of dealing with negative numbers for you, so -that arithmetic operations work transparently in the expected -manner. There can be an unexpected complication in dealing with the -`bitshift right operator (>>) <http://arduino.cc/en/Reference/Bitshift>`_ -however. - - - -Example -------- - -:: - - int ledPin = 13; - - - -Syntax ------- - -:: - - int var = val; - - - - -- var - your int variable name -- val - the value you assign to that variable - - - -Coding Tip ----------- - -When variables are made to exceed their maximum capacity they "roll -over" back to their minimum capacitiy, note that this happens in -both directions. - - - -:: - - int x - x = -32,768; - x = x - 1; // x now contains 32,767 - rolls over in neg. direction - - x = 32,767; - x = x + 1; // x now contains -32,768 - rolls over - - - -See Also --------- - - -- `byte <http://arduino.cc/en/Reference/Byte>`_ -- `unsigned int <http://arduino.cc/en/Reference/UnsignedInt>`_ -- `long <http://arduino.cc/en/Reference/Long>`_ -- `unsigned long <http://arduino.cc/en/Reference/UnsignedLong>`_ -- `Integer Constants <http://arduino.cc/en/Reference/IntegerConstants>`_ -- `Variable Declaration <http://arduino.cc/en/Reference/VariableDeclaration>`_ |