long type test

This is a test of long data type

Datatype for large integers. While integers can be as large as 2,147,483,647 and as low as -2,147,483,648 (stored as 32 bits), a long integer has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (stored as 64 bits). Use this datatype when you need a number to have a greater magnitude than can be stored within an int. Processing functions don't use this datatype, so while they work in the language, you'll usually have to convert to a int using the (int) syntax before passing into a function.

Test written by Daniel Hodgin

Source Code:

// long data type example
long a;          // Declare variable "a" of type int
a = 9876543210;          // Assign "a" the value 9876543210
long b = a * 2;   // Declare variable "b" and assign it the value 19753086420
long c = a + b;  // Declare variable "c" and assign it the sum of "a" and "b"
println(a);
println(b);
println(c);
c = (c - 30) / 100;
int i = (int)c;  // Converts the value of "c" from a long to a int
println(i);