Reference.IntegerConstants History

Hide minor edits - Show changes to output

December 29, 2008, at 12:43 AM by Paul Badger -
Changed lines 16-18 from:
8 (octal) 0173 leading "0" characters 0-7 valid

16 (hexadecimal) 0x7B leading "0x" characters 0-9, A-F, a-f valid
to:
8 (octal) 0173 leading "0" characters 0-7 valid

16 (hexadecimal) 0x7B leading "0x" characters 0-9, A-F, a-f valid
December 29, 2008, at 12:42 AM by Paul Badger -
Changed line 13 from:
2 (binary) B1111011 capital 'B' only works with 8 bit values (0 to 255)
to:
2 (binary) B1111011 leading 'B' only works with 8 bit values (0 to 255)
Changed lines 16-18 from:
8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F, a-f valid
to:
8 (octal) 0173 leading "0" characters 0-7 valid

16 (hexadecimal) 0x7B leading "0x" characters 0-9, A-F, a-f valid
September 21, 2008, at 05:05 PM by Paul Badger -
Changed line 25 from:
101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)
to:
101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)
Changed line 45 from:
0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
Changed line 54 from:
0x101 // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1)
to:
0x101 // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1)
September 21, 2008, at 05:03 PM by Paul Badger -
Changed line 37 from:
myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte
to:
myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte
September 21, 2008, at 05:02 PM by Paul Badger -
Changed line 47 from:
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.
to:
->It is possible to generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.
September 21, 2008, at 05:01 PM by Paul Badger -
Changed lines 66-68 from:
\\\

to:
\\

September 21, 2008, at 05:00 PM by Paul Badger -
Changed lines 27-28 from:

to:
\\
September 21, 2008, at 04:59 PM by Paul Badger -
September 21, 2008, at 04:59 PM by Paul Badger -
Changed lines 47-48 from:
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.\\
to:
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.
\\
September 21, 2008, at 04:58 PM by Paul Badger -
Changed lines 47-50 from:
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.
\\\

to:
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.\\
September 21, 2008, at 04:57 PM by Paul Badger -
Changed lines 46-47 from:
->!!!! Warning
It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal
to:
->Warning
->It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal.
September 21, 2008, at 04:56 PM by Paul Badger -
Changed lines 46-47 from:
!!!!! Warning
You can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal
to:
->!!!! Warning
It is possible can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal
September 21, 2008, at 04:55 PM by Paul Badger -
Changed line 46 from:
!!!! Warning
to:
!!!!! Warning
September 21, 2008, at 04:55 PM by Paul Badger -
Changed lines 24-25 from:
Example:
[@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)
to:
Example:[@
101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)
Changed lines 56-57 from:
@]\\\
to:
@]


September 21, 2008, at 04:52 PM by Paul Badger -
Changed lines 24-26 from:
Example: @@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@@

\\
to:
Example:
[@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)
@]

September 21, 2008, at 04:51 PM by Paul Badger -
September 21, 2008, at 04:51 PM by Paul Badger -
Changed lines 29-30 from:
Example:
[@
to:
Example:[@
September 21, 2008, at 04:50 PM by Paul Badger -
Deleted line 32:
Changed lines 35-38 from:
@@myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte @@
\\\

to:
[@
myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte
@]

Changed lines 43-44 from:
[@ 0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
[@
0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
Changed lines 52-54 from:
Example: [@0x101 // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @]
\\\
to:
Example:
[@
0x101 // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1)
@]\\\
September 21, 2008, at 04:48 PM by Paul Badger -
Changed lines 29-30 from:
Example: [@B101 // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
to:
Example:
[@
B101 // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)
@]
September 21, 2008, at 04:47 PM by Paul Badger -
Changed lines 24-25 from:
Example:@@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@@
to:
Example: @@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@@
September 21, 2008, at 04:47 PM by Paul Badger -
Changed lines 24-26 from:
Example: \\
[@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
to:
Example:@@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@@
September 21, 2008, at 04:46 PM by Paul Badger -
Changed line 24 from:
Example:\\
to:
Example: \\
September 21, 2008, at 04:45 PM by Paul Badger -
Changed lines 24-25 from:
Example: [@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
to:
Example:\\
[@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
September 21, 2008, at 04:42 PM by Paul Badger -
Changed lines 39-40 from:
Example:[@ 0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
Example:
[@ 0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
September 21, 2008, at 04:40 PM by Paul Badger -
Changed lines 54-55 from:
* a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u
* a 'l' or 'L' to force the constant into a long data format. Example: 100000L
to:
* a 'u' or 'U' to force the constant into an unsigned data format. Example: @@33u@@
* a 'l' or 'L' to force the constant into a long data format. Example: @@100000L@@
September 21, 2008, at 04:39 PM by Paul Badger -
Changed lines 56-59 from:
* a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767ul


to:
* a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: @@32767ul@@
\\\

September 21, 2008, at 04:38 PM by Paul Badger -
Changed lines 57-58 from:
\\
to:


September 21, 2008, at 04:37 PM by Paul Badger -
Changed lines 24-25 from:
Example: [@101 // == 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
to:
Example: [@101 // same as 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
Changed lines 29-32 from:
[@Example: B101 // == 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]

The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it's convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as this:
to:
Example: [@B101 // same as 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]

The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it is convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as:
Changed line 39 from:
Example:[@ 0101 // == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
Example:[@ 0101 // same as 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
Changed line 47 from:
Example: @@0x101 == 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @@
to:
Example: [@0x101 // same as 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @]
September 21, 2008, at 04:34 PM by Paul Badger -
Changed lines 24-25 from:
Example: [@101 == 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
to:
Example: [@101 // == 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
Changed lines 29-30 from:
[@Example: B101 == 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
to:
[@Example: B101 // == 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
Changed line 39 from:
[@Example: 0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
Example:[@ 0101 // == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
September 21, 2008, at 04:32 PM by Paul Badger -
Changed lines 22-23 from:
'''Decimal''' is base 10, this is the common-sense math with which you are acquainted. Constants without other prefixes are assumed to be decimal format.
to:
'''Decimal''' is base 10. This is the common-sense math with which you are acquainted. Constants without other prefixes are assumed to be in decimal format.
September 21, 2008, at 04:29 PM by Paul Badger -
Changed lines 45-46 from:
'''Hexadecimal (or hex)''' is base sixteen. Valid characters are 0 through 9 and letters A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15. Hex values are indicated by the prefix "0x"
to:
'''Hexadecimal (or hex)''' is base sixteen. Valid characters are 0 through 9 and letters A through F; A has the value 10, B is 11, up to F, which is 15. Hex values are indicated by the prefix "0x". Note that A-F may be syted in upper or lower case (a-f).
September 08, 2008, at 04:25 AM by Paul Badger -
Changed line 13 from:
2 (binary) B1111011 capital 'B' only works with 8 bit values
to:
2 (binary) B1111011 capital 'B' only works with 8 bit values (0 to 255)
Changed lines 22-23 from:
'''Decimal''' is base 10, this is the common-sense math with which you are aquainted.
to:
'''Decimal''' is base 10, this is the common-sense math with which you are acquainted. Constants without other prefixes are assumed to be decimal format.
Changed lines 37-38 from:
'''Octal''' is base eight. Only characters 0 through 7 are valid.
to:
'''Octal''' is base eight. Only characters 0 through 7 are valid. Octal values are indicated by the prefix "0"
Changed lines 45-46 from:
'''Hexadecimal (or hex)''' is base sixteen. Valid characters are 0 through 9 and letters A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.
to:
'''Hexadecimal (or hex)''' is base sixteen. Valid characters are 0 through 9 and letters A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15. Hex values are indicated by the prefix "0x"
March 17, 2008, at 05:21 PM by Paul Badger -
Changed lines 52-53 from:
By default, an integer constant is treated as an [[int]] with the attendant limitations in values. To specify an integer constant with another data type, follow it with::
to:
By default, an integer constant is treated as an [[int]] with the attendant limitations in values. To specify an integer constant with another data type, follow it with:
February 13, 2008, at 05:41 PM by David A. Mellis -
Changed lines 3-5 from:
Integer constants are numbers used directly in a sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but special notation (formatters) may be used to enter numbers in other bases.

to:
Integer constants are numbers used directly in a sketch, like @@123@@. By default, these numbers are treated as [[int]]'s but you can change this with the U and L modifiers (see below).

Normally, integer constants are treated as base 10 (decimal) integers, but special notation (formatters) may be used to enter numbers in other bases.

Changed lines 52-53 from:
An integer constant may be followed by:
to:
By default, an integer constant is treated as an [[int]] with the attendant limitations in values. To specify an integer constant with another data type, follow it with::
November 24, 2007, at 12:06 AM by Paul Badger -
Changed lines 3-5 from:
Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation (formatters) to enter numbers in other bases.

to:
Integer constants are numbers used directly in a sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but special notation (formatters) may be used to enter numbers in other bases.

July 17, 2007, at 08:26 PM by David A. Mellis -
Changed lines 50-51 from:
In the C language, an integer constant may be followed by:
to:
An integer constant may be followed by:
July 17, 2007, at 08:25 PM by David A. Mellis - hex digits can be lowercase too
Changed line 16 from:
16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
to:
16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F, a-f valid
July 17, 2007, at 02:34 PM by Paul Badger -
Changed lines 7-8 from:
Base Example Formatter Comment
to:
Base Example Formatter Comment
Changed lines 11-16 from:
2 (binary) B1111011 capital 'B' only works with 8 bit values
characters 0-1 valid

8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
to:
2 (binary) B1111011 capital 'B' only works with 8 bit values
characters 0-1 valid

8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
July 17, 2007, at 02:33 PM by Paul Badger -
Changed lines 7-8 from:
Base Example Formatter Comment
to:
Base Example Formatter Comment
Changed lines 11-16 from:
2 (binary) B1111011 capital 'B' (only works with 8 bit values)
characters 0-1 valid

8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
to:
2 (binary) B1111011 capital 'B' only works with 8 bit values
characters 0-1 valid

8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
July 17, 2007, at 02:33 PM by Paul Badger -
Changed lines 12-13 from:
to:
characters 0-1 valid
July 17, 2007, at 02:30 PM by Paul Badger -
Changed lines 51-53 from:
* a 'u' or 'U' to force the constant into an unsigned data format, like 33u
* a 'l' or 'L' to indicate a long constant, like 100000L
* a 'ul' or 'UL' to indicate an unsigned long constant, like 32767ul
to:
* a 'u' or 'U' to force the constant into an unsigned data format. Example: 33u
* a 'l' or 'L' to force the constant into a long data format. Example: 100000L
* a 'ul' or 'UL' to force the constant into an unsigned long constant. Example: 32767ul
July 17, 2007, at 02:28 PM by Paul Badger -
Changed line 51 from:
* a 'u' or 'U' to indicate an unsigned constant, like 33u
to:
* a 'u' or 'U' to force the constant into an unsigned data format, like 33u
July 17, 2007, at 02:24 PM by Paul Badger -
Changed line 38 from:
You can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler unintentionally interpret your contstant as octal
to:
You can generate a hard-to-find bug by (unintentionally) including a leading zero before a constant and having the compiler unintentionally interpret your constant as octal
July 17, 2007, at 02:23 PM by Paul Badger -
Added line 55:
July 17, 2007, at 02:23 PM by Paul Badger -
Changed line 54 from:
to:
\\
July 17, 2007, at 02:22 PM by Paul Badger -
Changed lines 54-55 from:
\\\
to:
July 17, 2007, at 02:22 PM by Paul Badger -
Changed lines 54-57 from:
\\\\


to:
\\\
July 17, 2007, at 02:21 PM by Paul Badger -
Changed line 23 from:
\\\
to:
\\
June 10, 2007, at 03:09 AM by Paul Badger -
Changed line 60 from:
* [[Define|#Define]]
to:
* [[Define|#define]]
June 10, 2007, at 03:08 AM by Paul Badger -
Added line 60:
* [[Define|#Define]]
May 29, 2007, at 05:19 AM by David A. Mellis - fixing typo 2 -> 10 in decimal example
Changed lines 21-22 from:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
to:
Example: [@101 == 101 decimal ((1 * 10^2) + (0 * 10^1) + 1)@]
May 28, 2007, at 09:01 PM by Paul Badger -
Changed line 59 from:
* [[Constants]]
to:
* [[constants]]
May 28, 2007, at 09:00 PM by Paul Badger -
Changed line 52 from:
* a 'l' or 'L' to indicate a long constant, like 100000l
to:
* a 'l' or 'L' to indicate a long constant, like 100000L
May 28, 2007, at 08:08 PM by Paul Badger -
Added line 62:
* [[UnsignedInt| unsigned int]]
Changed lines 64-65 from:
to:
* [[UnsignedLong | unsigned long]]
May 28, 2007, at 08:07 PM by Paul Badger -
Added line 52:
* a 'l' or 'L' to indicate a long constant, like 100000l
May 28, 2007, at 08:05 PM by Paul Badger -
Added lines 47-56:
!!!! U & L formatters

In the C language, an integer constant may be followed by:

* a 'u' or 'U' to indicate an unsigned constant, like 33u
* a 'ul' or 'UL' to indicate an unsigned long constant, like 32767ul
\\\\


May 28, 2007, at 08:03 PM by Paul Badger -
Deleted line 23:
May 28, 2007, at 08:02 PM by Paul Badger -
Added line 22:
May 28, 2007, at 08:01 PM by Paul Badger -
Changed lines 22-23 from:
to:
\\\
May 28, 2007, at 08:01 PM by Paul Badger -
Changed lines 5-6 from:
\\\
to:
Changed lines 22-24 from:
\\\

to:
May 28, 2007, at 07:58 PM by Paul Badger -
Changed lines 8-9 from:
Base Example Formatter Comment
to:
Base Example Formatter Comment
Changed lines 12-16 from:
2 (binary) B1111011 capital 'B' (only works with 8 bit values)

8 (octal) 0173 leading zero

16 (hexadecimal) 0x7B leading 0x
to:
2 (binary) B1111011 capital 'B' (only works with 8 bit values)

8 (octal) 0173 leading zero characters 0-7 valid

16 (hexadecimal) 0x7B leading 0x characters 0-9, A-F valid
May 28, 2007, at 07:56 PM by Paul Badger -
Changed lines 8-16 from:
Base Example Comment

10 (decimal) 123

2 (binary) B1111011 (only works with 1 to 8 bit values)

8 (octal) 0173

16 (hexadecimal) 0x7B
to:
Base Example Formatter Comment

10 (decimal) 123 none

2 (binary) B1111011 capital 'B' (only works with 8 bit values)

8 (octal) 0173 leading zero

16 (hexadecimal) 0x7B leading 0x
May 28, 2007, at 07:46 PM by Paul Badger -
Changed line 40 from:
You can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler interpreting your constant unintentionally interpreted as octal
to:
You can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler unintentionally interpret your contstant as octal
May 28, 2007, at 07:45 PM by Paul Badger -
Changed lines 39-40 from:

One can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler interpreting your constant (unwantedly) as octal
to:
!!!! Warning
You can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler interpreting your constant unintentionally interpreted as octal
April 29, 2007, at 12:08 PM by David A. Mellis -
Changed lines 10-16 from:
10 (decimal) 123 default format - cannot start with 0 (zero)

2 (binary) B1111011 use capital B only (not C++ 0b), only works on bytes

8 (octal) 0173 start constant with zero (0)

16 (hexadecimal) 0x7B start with zero - x (0x)
to:
10 (decimal) 123

2 (binary) B1111011 (only works with 1 to 8 bit values)

8 (octal) 0173

16 (hexadecimal) 0x7B
April 29, 2007, at 12:07 PM by David A. Mellis - don't confuse things with extraneous information.
Deleted lines 4-6:
So why would one ''want'' to enter numbers in another base? Often it is convenient to enter numbers in binary form if they are being used to set [[PortManipulation|port variables]]. This often corresponds to setting one pin HIGH and another LOW, for example.

Numbers are sometimes entered in hexidecimal to save characters in entering larger numbers. This is something that comes with practice to programmers but is often confusing to beginners.
April 26, 2007, at 05:55 AM by Paul Badger -
April 26, 2007, at 05:54 AM by Paul Badger -
Changed line 7 from:
Numbers are sometimes entered in hexidecimal to save characters in entering larger numbers. This is something that comes with practice to programmers but is often confusing to beginning programmers.
to:
Numbers are sometimes entered in hexidecimal to save characters in entering larger numbers. This is something that comes with practice to programmers but is often confusing to beginners.
April 26, 2007, at 05:52 AM by Paul Badger -
Added line 46:
April 26, 2007, at 05:51 AM by Paul Badger -
Changed lines 10-11 from:

[@
to:
[@
April 26, 2007, at 05:50 AM by Paul Badger -
Changed lines 8-10 from:


to:
\\\

April 26, 2007, at 05:50 AM by Paul Badger -
Changed lines 3-4 from:
Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation (formatters) to enter numbers in other bases. See the following table for details.
to:
Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation (formatters) to enter numbers in other bases.

So why would one ''want'' to enter numbers in another base? Often it is convenient to enter numbers in binary form if they are being used to set [[PortManipulation|port variables]]. This often corresponds to setting one pin HIGH and another LOW, for example.

Numbers are sometimes entered in hexidecimal to save characters in entering larger numbers. This is something that comes with practice to programmers but is often confusing to beginning programmers.


April 26, 2007, at 05:43 AM by Paul Badger -
Changed lines 26-27 from:
[@Example: B101 == 5 decimal. a@]
to:
[@Example: B101 == 5 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
April 26, 2007, at 05:42 AM by Paul Badger -
Changed lines 26-27 from:
Example: @@B101 == 5 decimal. @@
to:
[@Example: B101 == 5 decimal. a@]
April 26, 2007, at 05:41 AM by Paul Badger -
Changed lines 36-37 from:
Example: [@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
to:
[@Example: 0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
April 26, 2007, at 05:34 AM by Paul Badger -
Changed line 20 from:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
to:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
April 26, 2007, at 05:34 AM by Paul Badger -
April 26, 2007, at 05:29 AM by Paul Badger -
Changed line 20 from:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
to:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
April 26, 2007, at 05:27 AM by Paul Badger -
Changed line 20 from:
Example: @@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1) @@
to:
Example: [@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1)@]
Changed lines 36-37 from:
Example: @@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @@
to:
Example: [@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @]
April 26, 2007, at 05:26 AM by Paul Badger -
Changed line 20 from:
Example: @@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1) @@
to:
Example: @@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1) @@
Changed lines 36-37 from:
Example: @@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @@
to:
Example: @@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @@
Changed line 43 from:
Example: @@0x101 == 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @@
to:
Example: @@0x101 == 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @@
April 26, 2007, at 05:25 AM by Paul Badger -
Changed line 20 from:
Example: @@101 == 101 decimal@@
to:
Example: @@101 == 101 decimal ((1 * 2^2) + (0 * 2^1) + 1) @@
Changed lines 36-37 from:
Example: @@0101 == 65 decimal (1 * 8^2) + (0 * 8^1) + 1 @@
to:
Example: @@0101 == 65 decimal ((1 * 8^2) + (0 * 8^1) + 1) @@
Added line 40:
Changed lines 43-45 from:
Example: @@0x101 == 257 decimal (1 * 16^2) + (0 * 16^1) + 1 @@

to:
Example: @@0x101 == 257 decimal ((1 * 16^2) + (0 * 16^1) + 1) @@
\\\
Added line 47:
* [[Constants]]
April 26, 2007, at 05:22 AM by Paul Badger -
Added line 23:
April 26, 2007, at 05:18 AM by Paul Badger -
Changed lines 21-23 from:


to:
\\\
Changed lines 37-38 from:
to:
One can generate a hard-to-find bug by unintentionally including a leading zero before a constant and having the compiler interpreting your constant (unwantedly) as octal
\\\
Changed lines 43-47 from:
To decode a two-digit hex value into decimal multiply the most significant (left-most) digit by 16 and add the right digit.


!!!!Example
to:
April 26, 2007, at 05:14 AM by Paul Badger -
Changed lines 31-33 from:
\\

to:
\\\

April 26, 2007, at 05:13 AM by Paul Badger -
Changed lines 31-33 from:
\\\\

to:
\\

April 26, 2007, at 05:13 AM by Paul Badger -
Changed lines 31-33 from:


to:
\\\\

April 26, 2007, at 05:11 AM by Paul Badger -
Changed lines 28-33 from:
to:
The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it's convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as this:

@@myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte @@


Changed lines 36-45 from:
Example: @@0101 == 65 decimal@@



Notice that in hexadecimal, valid characters are 0 through 9 and A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15. To decode a two-digit hex value into decimal multiply the most significant (left-most) digit by 16 and add the right digit.

The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it's convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as this:

@@myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte @@
to:
Example: @@0101 == 65 decimal (1 * 8^2) + (0 * 8^1) + 1 @@


'''Hexadecimal (or hex)''' is base sixteen. Valid characters are 0 through 9 and letters A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.

Example: @@0x101 == 257 decimal (1 * 16^2) + (0 * 16^1) + 1 @@

To decode a two-digit hex value into decimal multiply the most significant (left-most) digit by 16 and add the right digit.

April 26, 2007, at 05:02 AM by Paul Badger -
Changed lines 18-20 from:
'''Decimal''' is base 10, this is the common-sense math with which you are aquainted. Example: @@101 == 101 decimal@@

to:
'''Decimal''' is base 10, this is the common-sense math with which you are aquainted.

Example: @@101 == 101 decimal@@


Added line 28:
Added lines 33-34:

April 26, 2007, at 05:01 AM by Paul Badger -
Changed lines 18-24 from:



'''Binary''' is base two. Only characters 0 and 1 are valid. Example: B101 == 5 decimal.


to:
'''Decimal''' is base 10, this is the common-sense math with which you are aquainted. Example: @@101 == 101 decimal@@


'''Binary''' is base two. Only characters 0 and 1 are valid.

Example: @@B101 == 5 decimal. @@

'''Octal''' is base eight. Only characters 0 through 7 are valid.

Example: @@0101 == 65 decimal@@
April 26, 2007, at 04:54 AM by Paul Badger -
Added lines 18-20:


April 26, 2007, at 04:54 AM by Paul Badger -
Added lines 17-21:

'''Binary''' is base two. Only characters 0 and 1 are valid. Example: B101 == 5 decimal.


April 26, 2007, at 04:51 AM by Paul Badger -
Changed lines 6-14 from:
Base Example Comment

10 (decimal) 123 default format - cannot start with 0 (zero)

2 (binary) B1111011

8 (octal) 0173

16 (hexadecimal) 0x7B
to:
Base Example Comment

10 (decimal) 123 default format - cannot start with 0 (zero)

2 (binary) B1111011 use capital B only (not C++ 0b), only works on bytes

8 (octal) 0173 start constant with zero (0)

16 (hexadecimal) 0x7B start with zero - x (0x)
April 26, 2007, at 04:48 AM by Paul Badger -
Changed lines 3-4 from:
Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation to enter numbers in other bases. See the following table for details.
to:
Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation (formatters) to enter numbers in other bases. See the following table for details.
Changed lines 6-7 from:
Base Example
10 (decimal) 123
to:
Base Example Comment

10 (decimal) 123 default format - cannot start with 0 (zero)
Added line 11:
Added line 13:
Changed lines 15-16 from:
@]
to:
@]
April 25, 2007, at 01:19 AM by Paul Badger -
Changed lines 13-14 from:
Notice that in hexadecimal, valid characters are 0 through 9 and A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.
to:
Notice that in hexadecimal, valid characters are 0 through 9 and A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15. To decode a two-digit hex value into decimal multiply the most significant (left-most) digit by 16 and add the right digit.
Deleted lines 18-20:


Deleted line 25:
[[HomePage | Reference Home]]
April 25, 2007, at 01:17 AM by Paul Badger -
Changed lines 17-21 from:
@@myInt = (B11001100 * 256) + B10101010; // first constant is the high byte



to:
@@myInt = (B11001100 * 256) + B10101010; // B11001100 is the high byte @@



April 25, 2007, at 01:16 AM by Paul Badger -
Changed lines 13-16 from:
Notice that in hexadecimal, some digits can be letters; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.

The binary constants only work between 0 (B0) and 255 (B11111111). The others can be negative and bigger.
to:
Notice that in hexadecimal, valid characters are 0 through 9 and A through F; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.

The binary formatter only works on bytes (8 bits) between 0 (B0) and 255 (B11111111). If it's convenient to input an int (16 bits) in binary form you can do it a two-step procedure such as this:

@@myInt = (B11001100 * 256) + B10101010; // first constant is the high byte



December 02, 2006, at 04:30 PM by David A. Mellis -
Added lines 15-16:
The binary constants only work between 0 (B0) and 255 (B11111111). The others can be negative and bigger.
December 02, 2006, at 04:28 PM by David A. Mellis -
Changed lines 6-10 from:
Name Base Prefix Example Value
Decimal 10 none 123 123
Binary 2 B B1111011 123
Octal 8 0 0173 123
Hexadecimal 16 0x 0x7B 123
to:
Base Example
10 (decimal) 123
2 (binary) B1111011
8 (octal) 0173
16 (hexadecimal) 0x7B
December 02, 2006, at 04:26 PM by David A. Mellis -
Added lines 1-22:
!!Integer Constants

Integer constants are the numbers you type directly into your sketch, like @@123@@. Normally, these numbers are treated as base 10 (decimal) integers, but you can use special notation to enter numbers in other bases. See the following table for details.

[@
Name Base Prefix Example Value
Decimal 10 none 123 123
Binary 2 B B1111011 123
Octal 8 0 0173 123
Hexadecimal 16 0x 0x7B 123
@]

Notice that in hexadecimal, some digits can be letters; @@A@@ has the value 10, @@B@@ is 11, up to @@F@@, which is 15.

!!!!Example

!!!!See also
* [[byte]]
* [[int]]
* [[long]]

[[HomePage | Reference Home]]

Share