Main Content
cast
Convert variable to different data type
Description
returns the data in B
= cast(A
,newclass
)A
converted to the data type (class)
newclass
, where newclass
is the name of a built-in
data type compatible with A
. Any values in A
that are
outside the range of newclass
are truncated in B
to
the nearest endpoint.
When converting a floating-point number to an integer, the cast
function rounds the number to the nearest integer. If the floating-point number has a
fractional part of exactly 0.5, then it rounds away from zero to the integer with larger
magnitude.