can_cast#

rbc.stdlib.data_type_functions.can_cast(from_, to)#

Determines if one data type can be cast to another data type according Type Promotion Rules rules.

Examples

>>> from rbc.stdlib import array_api
>>> @heavydb('bool(int64)')
... def can_cast(_):
...     return array_api.can_cast(array_api.int8, array_api.int32)
>>> can_cast(0).execute()
True
>>> @heavydb('bool(int64)')
... def can_cast(_):
...     return array_api.can_cast(array_api.float32, array_api.bool)
>>> can_cast(0).execute()
False

Array-API ‘can_cast’ doc