SHIP:Data Types:Double

From Serious Documentation
Jump to: navigation, search

See Also

Double

Double Data Types are available in SHIPv5 and onwards, and are double precision IEEE754 floating point values.

Data Type Description
Double A double precision IEEE754 64-bit floating point value.

Double constants in SHIPTide must be written with a decimal point, at least one digit before and one digit after the decimal point. There is not specific Double designator, like Float's "f", to make a number a double.

Examples of Double constants:

  • 1.0 is 1.0
  • -2.324 is -2.324
  • .3 is invalid, since there are no digits in front of the decimal point; add a leading 0
  • 1d is invalid, since there is no decimal point, trailing digits after the decimal point, nor is "d" a Double designator
  • 1.d is invalid, since there are no trailing digits after the decimal point nor is "d" a Double designator

Casting Rules

From To Description
Double Byte fractional elements removed, fit within the Byte range
Double Short fractional elements removed, fit within the Short range
Double Integer fractional elements removed
Double Boolean a value of false if exactly 0.0, otherwise true
Double Byte fractional elements removed, fit within the Byte range
Byte Double simple cast
Short Double simple cast
Integer Double simple cast, but limited to maximum and minimum Double range which is smaller than Integer
Boolean Double a value of 0.0 for false and 1.0 for true