double
- Last UpdatedSep 17, 2025
- 1 minute read
This topic is about the double data type.
Value syntax
13.565
12
-2343.4324
Description
Double type represents real numbers and includes both float and double c# type, since float are cast to double. Moreover, numbers are internally treated as double during operations execution and eventually cast to the final data type when they get written to the result variable. See arithmetic operators for further details.
-
The default value is zero, 0.
-
Double type supports arithmetic and comparison operators.
The XRS scripting language currently does not provide a definition of NaN for double type. Hence, in order to check if the value of a double variable is NaN, it is necessary to cast it to string, as in the following example:
value=Runtime::Math.Asin(pi_2);
Runtime::Environment.Assert(value.ToString()=="NaN", "value must be NaN");
Autocasting
Double type supports autocasting for:
-
string, if in the correct input format; otherwise, it will raise an exception.
double a=”2.1”; //a=2.1;
-
int
int a=1;
double b=a; //b=1;
Methods
This table shows the currently implemented methods.
|
Method |
Return type |
Parameters |
Description |
|---|---|---|---|
|
IsZero |
bool |
double epsilon |
Checks if value is inside [-epsilon epsilon] range. The epsilon parameter is optional, when not set, it uses default value 4.94065645841247E-324. |
|
ToString |
string |
Returns a string that represents the current double value. |