Skip to main content Link Search Menu Expand Document Toggle dark mode Copy Code (external link)

double() : Convert to Double

Convert a value to a double-precision floating-point number.


On this page

Signature

double(value)

Parameters

Parameter Type Required Description
value Any Yes The value to convert to double

Returns

Type: Double

A double-precision floating-point representation of the value.


Examples

Convert String to Double

<p>Value: {{double(model.stringValue)}}</p>

Data:

doc.Params["model"] = new {
    stringValue = "3.14159"
};

Output:

<p>Value: 3.14159</p>

Scientific Calculations

<p>Result: {{format(double(model.coefficient) * pow(10, model.exponent), '0.00e+00')}}</p>

Data:

doc.Params["model"] = new {
    coefficient = "6.626",
    exponent = -34
};

Output:

<p>Result: 6.63e-34</p>

Percentage to Decimal

<p>Rate: {{double(model.percentage) / 100}}</p>

Data:

doc.Params["model"] = new {
    percentage = "8.5"
};

Output:

<p>Rate: 0.085</p>

Notes

  • Preserves decimal precision
  • Handles string-to-double conversion
  • Throws exception if value cannot be converted
  • Range: ±5.0 × 10^−324 to ±1.7 × 10^308
  • For exact decimal calculations (like currency), use decimal() instead
  • Subject to floating-point precision limitations

See Also