In BigQuery, CASTing from FLOAT64 to INT64 is rounding (not flooring)

21 Feb 2017

It is a bit counter-intuitive for programmers… but it is said right there in (the documentation)[]:

FLOAT64 to INT64 – Returns the closest INT64 value. Halfway cases such as 1.5 or -0.5 round away from zero.

Admittedly, it might be more intuitive for non-programmers who don't know that casting in any programming language is flooring.