8.2 Numbers

The number type can be used to store integer and real numbers. Internally, all numbers are stored as 64-bit floating point values which means that it can represent very large integers and very precise real numbers. The number type can store numbers ranging from 1.7*10^-308 to 1.7*10^308. The integer range is from -9007199254740992 to 9007199254740992.

You can also specify hexadecimal numbers by using the prefix $ or 0x, e.g.:

 
a = $FF     ; a = 255

Floating point numbers can also be specified by using the exponential notation, e.g.

 
a = 2.5e5   ; a = 2.5 * 10^5  => a = 250000

The 0 is optional for floating point values between -1 and 1. So the following code would also work:

 
a = .25 * 2 ; a = 0.5

Although Hollywood does not have separate data types for integer and floating point numbers, there is still the style-guide suggestion to suffix variables that are expected to hold floating point values with an exclamation mark. E.g.

 
a! = 3.14159265

This makes it easier to read your code because you know exactly which variables will get integer values only and which variables will get floating point values. Of course, you can use floating point values without the exclamation mark, but it is suggested that you use it.


Show TOC