Number: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Reverted edits by Heecf..... (talk) to last revision by Bn880)
m (Numbers stored as floating point numbers)
Line 1: Line 1:
=Number Type=
=Number Type=
A real number, i.e. 1, -25, 6.52, 1805.6352
A real number, i.e. 1, -25, 6.52, 1805.6352
Numbers are stored as [http://en.wikipedia.org/wiki/Single-precision_floating-point_format single precision floating point numbers], which allow for a large range of values with limited precision (generally accurate to 6 or 7 decimal places).


The largest real positive number that can be entered via script is:  3.4028235e38
The largest real positive number that can be entered via script is:  3.4028235e38

Revision as of 23:49, 11 October 2013

Number Type

A real number, i.e. 1, -25, 6.52, 1805.6352

Numbers are stored as single precision floating point numbers, which allow for a large range of values with limited precision (generally accurate to 6 or 7 decimal places).

The largest real positive number that can be entered via script is: 3.4028235e38

The largest real negative number that can be entered via script is: -3.4028235e38

Larger numbers: In scripts it is possible to generate a representation of an infinite positive or negative number which compares even larger or smaller than the above two floating point limits;

Positive infinity 1e39 = "1.#INF"

Negative infinity -1e39 = "-1.#INF"

Degrees

Degrees are a poetic licence used to indicate a number returned from functions like acos and asin

It's special properties are that it will always supply a value from 0 to 360

Radians

Another poetic licence for a Number. Used in angular math computations with commands like rad and deg

Scripting vs Addons

Integers and Floats

Note that unlike config.cpp's (addons), a Number in scripting language is ANY numeric entity. Floats, or integers. It is NOT the same as a config's Integer or Float. Number covers both types.

Booleans

Note also, unlike config.cpp's, Boolean is a real type in scripting language. In addons, it is a poetic licence for a zero/non zero Integer