Type Conversion in Expression Evaluation mysql>  SELECT 0 > ’x6’; -> 0 mysql>  SELECT 0 = ’x6’; -> 1 SELECT * FROM  tbl_name  WHERE  str_col =1; mysql>  SELECT ’9223372036854775807’ = 9223372036854775807; -> 1 mysql>  SELECT ’9223372036854775807’ = 9223372036854775806; -> 1 mysql>  SELECT CAST(’9223372036854775807’ AS UNSIGNED) = 9223372036854775806; -> 0 For comparisons of a string column with a number, MySQL cannot use an index on the column to look up the value quickly. If  str_col  is an indexed string column, the index cannot be used when performing the lookup in the following statement: The reason for this is that there are many different strings that may convert to the value  1 , such as  ’1’ ,  ’ 1’ , or  ’1a’ . Comparisons between floating-point numbers and large values of  INTEGER  type are approximate because the integer is converted to double-precision floating point before comparison, which is not capable of representing all 64-bit integers exactly. For example, the integer value 2$^{53}$ + 1 is not representable as a float, and is rounded to 2$^{53}$ or 2$^{53}$ + 2 before a float comparison, depending on the platform. To illustrate, only the first of the following comparisons compares equal values, but both comparisons return true (1): When conversions from string to floating-point and from integer to floating-point occur, they do not necessarily occur the same way. The integer may be converted to floating-point by the CPU, whereas the string is converted digit by digit in an operation that involves floating-point multiplications. Also, results can be affected by factors such as computer architecture or the compiler version or optimization level. One way to avoid such problems is to use  CAST()  so that a value is not converted implicitly to a float-point number: For more information about floating-point comparisons, see Section B.3.4.8, “Problems with Floating-Point Values” . The server includes  dtoa , a conversion library that provides the basis for improved conversion between string or  DECIMAL  values and approximate-value ( FLOAT / DOUBLE ) numbers: Because the conversions produced by this library differ in some cases from non- dtoa  results, the potential exists for incompatibilities in applications that rely on previous results. For example, applications that depend on a specific exact result from previous conversions might need adjustment to accommodate additional precision. The  dtoa  library provides conversions with the following properties.  D  represents a value with a  DECIMAL or string representation, and  F  represents a floating-point number in native binary (IEEE) format. • F  ->  D  conversion is done with the best possible precision, returning  D  as the shortest string that yields  F when read back in and rounded to the nearest value in native binary format as specified by IEEE. •Consistent conversion results across platforms, which eliminates, for example, Unix versus Windows conversion differences. •Accurate representation of values in cases where results previously did not provide sufficient precision, such as for values close to IEEE limits. •Conversion of numbers to string format with the best possible precision. The precision of  dtoa  is always the same or better than that of the standard C library functions. 2121