to.i64

to.i64, function

def const pure to.i64(a: number): i64
def const pure to.i64(a: f64): i64

Converts a to a signed 64-bit integer, discarding the fractional part (truncation toward zero).

Examples

table T = with
  [| as Input |]
  [| 12.75 |]
  [| -12.75 |]

T.Integer = to.i64(T.Input)
show table "Truncated values" with
  T.Input
  to.number(T.Integer) as "Integer"

The integer values are 12 and -12, respectively. to.number converts them back to single precision for display.

Remarks

This function is available in const expressions. to.long is an alias of to.i64, and long is an alias of the i64 type. The conversion does not recover precision already lost in its input.

i64 columns cannot be exported with write. Converting to number before export is possible but can lose integer precision.

See also

User Contributed Notes
0 notes + add a note