January 2020
Intermediate to advanced
532 pages
13h 31m
English
When it comes to conversion, it is important to consider whether the conversion is lossless or lossy. In general, it is expected that data type conversion is lossless, which means that, when you convert from one type to another and back, you get the same value.
Because of the numerical representation of floating-point numbers, such perfect conversion is not always possible. For example, let's try to convert 1//3 to Float64 and then convert it back to Rational:

Because of a rounding error, it is not possible to reconstruct 1//3 after it was converted to a Float64 type. The problem is not restricted to the Rational ...
Read now
Unlock full access