SHIP:Data Types:Float

From Serious Documentation
Revision as of 04:36, 19 April 2014 by Admin (talk | contribs) (Created page with "*'''Node Home''' *'''All Data Types''' <onlyinclude>Float Data Types are available in SHIPv5 and onwards, and are single precision floating ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Float Data Types are available in SHIPv5 and onwards, and are single precision floating point values.

Data Type Description
Float A single precision IEEE754 32-bit floating point value.

Float constants in SHIPTide must be written with a decimal point, at least one digit before and one digit after the decimal point, with a trailing "f".

Examples of Float constants:

  • 1.0f is 1.0
  • * -2.324f is -2.324</code>

.3f is invalid, since there are no digits in front of the decimal point; add a leading 0

  • 1f is invalid, since there is no decimal point nor trailing digits after the decimal point
  • 1.f is invalid, since there are no trailing digits after the decimal point


When Float values are assigned from other numeric data types (e.g. Byte, Short, Integer, Boolean), the cast is exact if the value is in range of the Float capabilities.

a zero value is cast to false, and a non-zero value is cast to true.

Conversely, when a Boolean value is assigned to another numeric data type (e.g. Byte, Short, Integer, Float), a false value is cast to zero, and a true value is cast to 1 (or 1.0f).