There are two ways to convert a value from one data type to another. The obvious choice is to construct a new object from an existing value. For example, we can construct a Float64 object from a rational number as follows:
Another way is to use the convert function:
Either way works fine. There is an advantage from using the convert function when considering performance optimization, as we will explain later in this section.