Cast
Cast[val,type]
converts val to the type type, for use in compiled code.
Cast[val,type,method]
uses the specified casting method.
Details
- Cast[value,type] reinterprets the bits representing val as having the type type.
- Cast is only available in compiled code.
- Possible values of method in Cast[val,type,method] include:
-
"BitCast" reinterprets the bits representing val as having the type type "CCast" emulates the behavior of casting in C - Cast[val,type,"BitCast"] behaves as though val is written to memory and read back as type.
- Cast[val,type,"CCast"] only supports numeric types.
- The input type to a bitcast must be the same length as the output type.
Examples
open allclose allBasic Examples (2)
Scope (2)
Wolfram Research (2022), Cast, Wolfram Language function, https://reference.wolfram.com/language/ref/Cast.html.
Text
Wolfram Research (2022), Cast, Wolfram Language function, https://reference.wolfram.com/language/ref/Cast.html.
CMS
Wolfram Language. 2022. "Cast." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Cast.html.
APA
Wolfram Language. (2022). Cast. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Cast.html