Reference.Int History

Hide minor edits - Show changes to markup

June 01, 2010, at 02:39 AM by Equipo Traduccion - Ver enlace a doc en inglés
Changed lines 3-13 from:

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. 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 (>>) however.

Example

to:

Descripción

Integers (Números enteros) son el principal tipo de datos para almacenar números, y guardan valores de 2 bytes. Esto produce un rango entre -32,768 hasta 32,767 (valor mínimo de -2^15 y un valor máximo de (2^15) - 1).

Variables tipo Int, almacenan números negativos con una técnica llamada Complemento a dos. El bit más alto, a veces llamado como "sign" bit, indica que el número es negativo. Se invierte el valor de cada uno de los bits, es decir, se realiza el complemento a uno, y se suma 1 al número obtenido.

La placa Arduino, se encarga de tratar con números negativos por tí, para que las operaciones aritméticas trabajen de manera transparente y en la forma esperada. Sin embargo, pueden haber complicaciones inesperadas al tratar con el operador right bitshift (>>).

Ejemplo

Changed lines 20-26 from:
  • 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.

to:
  • var - nombre de la variable int.
  • val - valor asignado a dicha variable.

Consejo

Cuando las variables son hechas para exceder su límite, éstas vuelven a su capacidad mínima, ésto sucede en ambas direcciones:

Changed lines 29-30 from:
   x = x - 1;       // x now contains 32,767 - rolls over in neg. direction
to:
   x = x - 1;       // x ahora contiene 32,767 - vuelve a empezar en dirección contraria.
Changed line 32 from:
   x = x + 1;       // x now contains -32,768 - rolls over
to:
   x = x + 1;       // x ahora contiene -32,768 - vuelve a empezar.
Changed lines 36-37 from:

See Also

to:

Ver También

June 25, 2009, at 01:03 PM by Paul Badger -
Added line 43:
  • Variable Declaration
December 29, 2008, at 12:40 AM by Paul Badger -
Added line 42:
May 27, 2007, at 03:52 AM by Paul Badger -
Changed lines 25-26 from:

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions

to:

When variables are made to exceed their maximum capacity they "roll over" back to their minimum capacitiy, note that this happens in both directions.

May 27, 2007, at 03:44 AM by Paul Badger -
Changed lines 9-11 from:

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 (>>) however.

to:

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 (>>) however.

April 29, 2007, at 12:15 PM by David A. Mellis -
Deleted line 41:
April 25, 2007, at 01:02 AM by Paul Badger -
Changed line 42 from:
to:
April 25, 2007, at 01:01 AM by Paul Badger -
Changed lines 7-11 from:

Int's store negative numbers with a technique called 2's complement math. The highest bit, sometimes refered to as the "sign" bit is 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 trasparently in the expected manner. There can be an additional complication in dealing with the bitshift right operator (>>) however.

to:

Int's store negative numbers with a technique called 2's complement math. 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 (>>) however.

April 25, 2007, at 01:00 AM by Paul Badger -
Changed lines 9-11 from:

The Arduino takes care of dealing with negative numbers for you so arithmetic operations work in the expected manner. There can be an additional complication in dealing with the bitshift right operator (>>) however.

to:

The Arduino takes care of dealing with negative numbers for you, so that arithmetic operations work trasparently in the expected manner. There can be an additional complication in dealing with the bitshift right operator (>>) however.

April 25, 2007, at 12:59 AM by Paul Badger -
Changed lines 5-6 from:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).

to:

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. The highest bit, sometimes refered to as the "sign" bit is 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 arithmetic operations work in the expected manner. There can be an additional complication in dealing with the bitshift right operator (>>) however.

Changed line 42 from:
to:
April 17, 2007, at 12:08 AM by David A. Mellis -
Changed line 22 from:

[@ unsigned int x

to:

[@ int x

April 17, 2007, at 12:08 AM by David A. Mellis -
Changed lines 11-12 from:

Parameters

to:

Syntax

April 17, 2007, at 12:07 AM by David A. Mellis -
Changed lines 31-32 from:
to:
April 16, 2007, at 09:25 PM by Paul Badger -
Changed lines 18-20 from:

to:

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

   unsigned 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

April 16, 2007, at 06:12 PM by Paul Badger -
Deleted lines 20-22:
April 16, 2007, at 08:08 AM by Paul Badger -
Changed lines 5-6 from:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of 2^15 - 1).

to:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1).

April 16, 2006, at 10:27 PM by David A. Mellis -
Changed lines 5-6 from:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,768 (minimum value of -2^15 and a maximum value of 2^15 - 1).

to:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of 2^15 - 1).

April 16, 2006, at 10:27 PM by David A. Mellis - int is 2 bytes, not 4.
Changed lines 5-6 from:

Integers are your primary datatype for number storage, and store a 4 byte value. This gives you a range of -2147483647 to 2147483647 (minimum value of - 2^31 and a maximum value of 2^31 - 1).

to:

Integers are your primary datatype for number storage, and store a 2 byte value. This gives you a range of -32,768 to 32,768 (minimum value of -2^15 and a maximum value of 2^15 - 1).

March 24, 2006, at 08:55 PM by Jeff Gray -
Changed lines 5-6 from:

Integers are your primary form of number storage, and store a 4 byte value. This gives you a range of -2147483647 to 2147483647 (minimum value of - 2^31 and a maximum value of 2^31 - 1).

to:

Integers are your primary datatype for number storage, and store a 4 byte value. This gives you a range of -2147483647 to 2147483647 (minimum value of - 2^31 and a maximum value of 2^31 - 1).

March 24, 2006, at 08:55 PM by Jeff Gray -
Changed lines 13-14 from:

int var = val;

to:
    int var = val;
March 24, 2006, at 08:55 PM by Jeff Gray -
Changed lines 13-14 from:

[int var = val;]

to:

int var = val;

March 24, 2006, at 08:55 PM by Jeff Gray -
Changed lines 13-14 from:

int var = val;

to:

[int var = val;]

March 24, 2006, at 08:54 PM by Jeff Gray -
Added lines 1-8:

int

Description

Integers are your primary form of number storage, and store a 4 byte value. This gives you a range of -2147483647 to 2147483647 (minimum value of - 2^31 and a maximum value of 2^31 - 1).

Example

Changed lines 11-23 from:

A data type that is 4 bytes long with a minimum value of - 2^31 and a maximum value of 2^31 - 1. Needed before declaring a new variable in your code.

to:

Parameters

int var = val;

  • var - your int variable name
  • val - the value you assign to that variable

Reference Home

February 14, 2006, at 04:58 PM by Erica Calogero -
Added lines 1-3:
    int ledPin = 13;

A data type that is 4 bytes long with a minimum value of - 2^31 and a maximum value of 2^31 - 1. Needed before declaring a new variable in your code.

Share