Chapter 14: Units
14.11. Limits on the size of numbers

There are still some serious restrictions. Inform has only whole numbers, not floating-point (though we could in principle simulate at least fixed-point numbers by writing something like "10.99kg specifies a weight"). And in its normal setting (see below), Inform only allows numbers from -32768 to 32767. Since a London bus only weighs 7000kg, 32000kg is plenty: on the other hand, if we wanted to measure weight in grammes instead, the limit would be just 32kg, an amount which a human can just about lift.

The limit also begins to bite when using multiple-number specifications. Internally, Inform stores the above "running time" as a number of seconds, so that 3'59 is actually stored as 239. Calculating the maximum legal running time is a nuisance, so we can instead check the "Kinds" page of the index, where we read that:

running time (plural running times)
Written in the following form: 3'59
Maximum value allowed: 546'07

The maximum legal running time is therefore a little over 9 hours, so the new Tori Amos album will not be a problem, but some of the more punishing German operas might break the bank.

These restrictions are a nuisance, but can normally be managed, and we gain the ability to run the resulting work of IF on a very wide variety of computers indeed, some extremely small. If we do need larger numbers, we can change to the Glulx virtual machine (using the Settings panel), which buys us integers in the much larger range -2147483648 to 2147483647 but at the cost of being playable on fewer devices.


230
*** Example  Alias
A telephone with phone numbers of the standard American seven-digit length.

RB


PreviousContentsNext