long() : Convert to Long Integer
On this page
Summary
Convert a value to a 64-bit long integer. Useful for large numbers that exceed Int32 range.
Signature
long(value)
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
value |
Any | Yes | The value to convert to long integer |
Returns
Type: Int64
A 64-bit integer representation of the value.
Examples
Large Number Conversion
Data:
doc.Params["model"] = new {
population = "7800000000"
};
Output:
<p>Population: 7,800,000,000</p>
File Size Calculation
Data:
doc.Params["model"] = new {
bytes = "52428800"
};
Output:
<p>Total Size: 50.00 MB</p>
Timestamp Conversion
Data:
doc.Params["model"] = new {
timestamp = "1679875200000"
};
Output:
<p>Timestamp: 1679875200000</p>
Notes
- Truncates decimal places (does not round)
- Handles string-to-long conversion
- Throws exception if value cannot be converted
- Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
- Use for large numbers that exceed Int32 range (-2.1B to 2.1B)
- For decimal precision, use
decimal()instead