Skip to main content Link Search Menu Expand Document (external link)

double() : Convert to Double


On this page

Summary

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

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: </p>

Data:

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

Output:

<p>Value: 3.14159</p>

Scientific Calculations

<p>Result: </p>

Data:

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

Output:

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

Percentage to Decimal

<p>Rate: </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