GOOC - Game Oriented Object C

GOOC - Game Oriented Object C

Next: Metre Constants, Previous: GOOL Integer Constants, Up: Constants
[Contents]

5.3.3. Real Number Constants

5.3.3. Real Number Constants

A real number constant is a value that represents a fractional number. Since the PlayStation does not support floating-point numbers, these are instead converted to Q8 fixed-point numbers, meaning the lower 8 bits denote the decimal part and the upper 24 bits denote the integer part.

Either the integer part or the fractional part may be omitted, but not both. If the fractional part is omitted, a decimal point . is still required, otherwise it will be parsed as an integer constant. Here are some examples of valid real numbers: 1.0 -55.0 -3. -.5 .1 +400.0

A real number may not be succeeded by any of the following strings of characters: M, m, S, s, Hz, hz, V, or v. These suffixes will form other data types described in later chapters.