Understanding the structure of Julia numeric types with introspection
Julia has a wealth of built-in numeric types, which users can make use of in order to achieve maximum time and memory efficiency of computations. Also, when writing methods, it is advisable to choose the most general numeric type to which a given method applies. However, it is hard to easily grasp the entire hierarchy of types. In this recipe, we show how you can explore the entire tree of base numeric types in Julia. Additionally, you will learn how to work with the type hierarchy in Julia.
The recipe is generic and can be applied to any other type.
Getting ready
Numeric types are the basic building blocks of any program. Julia provides a vast range of integer and floating-point numbers. In this recipe, you will inspect their hierarchy.
Note
In the GitHub repository for this recipe, you will find the commands.txt
file that contains the presented sequence of shell and Julia commands. Additionally, in the types.jl
file you...