Casting to a "smaller" type in Q
Casting is usually done by using the underlying types (e.g. from datetime to float) or the underlying bit representation (e.g. short infinity to int).
When casting from a "more general" type to a "less general" one (eg from int to short), the result is the largest number that can be held by the new variable.
For example:
`short$(-1 + 2 xexp 15) / 32767h
`short$(-1 + 2 xexp 20) /32767h
`short$0W /32767h
`boolean$32h /1b
This naturally generalizes to types that are supersets of others, like datetime and date or datetime and time:
`date$2014.01.06T14:25:57 / 2014.01.06
`time$2014.01.06T14:25:57.123 / 14:25:57.123
Written by Dionysios Barmpoutis
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#