Difference between revisions of "Number (type)"

From ComputerCraft Wiki
Jump to: navigation, search
(Consolidate is not the word you were looking for. You wanted consult.)
(Merged Float and Int together.)
Line 1: Line 1:
A '''number''' is a data type which represents any real number (for example, 1, -900.1, or 13.37).
+
{{NeedsWork|This article needs more information before the {{type|int}} and {{type|float}} are removed. Please create a nice Table of Contents as well.}}
  
 +
A '''number''' is a data type which represents any real number (for example, 1, -900.1, or 13.37). There are a two types of different numbers that can be used within Lua programming.
 +
 +
==int==
 +
An '''int''' (short for 'integer') is a data type which represents a real, absolute number.
 +
 +
An integer is a whole-number (without an express or implied decimal point). For example, 1, 5, -102 and 101283 are all integers. Numbers like 9.5, 8.3 and -53124.4 are not integers, they are floating point numbers.
 +
 +
==Float==
 +
'''Float''' (short for "floating point") is a data-type for numbers.
 +
 +
Floating point numbers are decimals; they have an expressed decimal point and value (regardless of the value after the decimal place). For example, 1.4 and 5.2 are floats, and 1.0, 5.0 and 1293.0 are also floating point numbers.
 +
 +
Numbers without an express (or in the case of a floating point number, implied) decimal point are integers.
 +
 +
==More information==
 
For a more in-depth and concise explanation of types, please consult the [http://www.lua.org/manual/5.1/manual.html#2.2 Lua 5.1 Official Manual].
 
For a more in-depth and concise explanation of types, please consult the [http://www.lua.org/manual/5.1/manual.html#2.2 Lua 5.1 Official Manual].
  
 
[[Category:Lua_Types]]
 
[[Category:Lua_Types]]

Revision as of 10:04, 22 May 2013

This page needs some serious TLC, stat!
Please help us by cleaning it, fixing it up, or sparing it some love.
(Reason: This article needs more information before the int and float are removed. Please create a nice Table of Contents as well.)

A number is a data type which represents any real number (for example, 1, -900.1, or 13.37). There are a two types of different numbers that can be used within Lua programming.

int

An int (short for 'integer') is a data type which represents a real, absolute number.

An integer is a whole-number (without an express or implied decimal point). For example, 1, 5, -102 and 101283 are all integers. Numbers like 9.5, 8.3 and -53124.4 are not integers, they are floating point numbers.

Float

Float (short for "floating point") is a data-type for numbers.

Floating point numbers are decimals; they have an expressed decimal point and value (regardless of the value after the decimal place). For example, 1.4 and 5.2 are floats, and 1.0, 5.0 and 1293.0 are also floating point numbers.

Numbers without an express (or in the case of a floating point number, implied) decimal point are integers.

More information

For a more in-depth and concise explanation of types, please consult the Lua 5.1 Official Manual.