Type: Number

From Waltz
Revision as of 23:12, 9 February 2019 by Patrick Angle (talk | contribs) (Constructing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The Number type represents a number between -(263 - 1) and 263 - 1. Numbers are implemented as double-precision 64-bit binary format IEEE 754 compliant numbers. In addition to the normal range, there are three additional special values: +Infitinty, -Infinity, and Not a Number.

Note that there is no explicit integer type in Waltz. When a parameter expects an integer value, the decimal places of the number are simply ignored, so 1.67 becomes 1.

Constructing

There is no need to explicitly construct a Number, nor is there an explicit constructor. Assigning a literal numeric value is enough to create a Number. It is, however, important to note that there are several different ways to express a literal number:

Method Literal Expressiosn Actual Values (in Base 10)
Decimal 123456789

12345.6789

123456789

12345.6789

Octal 0755

0644

493

420

Hexadecimal 0x123456789ABCDEF

0XA

81985529216486900

10

Exponential 1E3

2e6

0.1e2

1000

2000000

10

Permitted Values

A number can be between -(263 - 1) and 263 - 1. Keep in mind that the inherent precision of numbers decreases the further from 0 they are until you exceed the normal range, at which point there is not precision and the number has been either +Infinity or -Infinity.

Primitive Bridging

The Number type exists both in Waltz's native context as well as in its Script Expressions. Internally Waltz refers to Numbers as Doubles in reference to their double-precision nature. Numbers are sometimes converted to integers with no decimal places when decimal precision would otherwise make no sense, like when referring to port with a RemoteAddress/IP.

Types
Primitives Boolean · Number · String
Objects Color · Dimension · DmxMultiverse · DmxUniverse · LocalInterface · Material · Point · RemoteAddress/IP · Scene · Time · Touch
Node Specific NdiSource · WoControlCue · WoHitTestResult · WoTimeline
Collections List · List of Lists · Map · Varargs
Special Any · Consumer · Expression · Null · Void