For correctly rounded decimal to floating-point conversions,
many open source projects rely on David Gay’s strtod() function.
In the default rounding mode, IEEE 754 round-to-nearest, this
function is known to give correct results (notwithstanding
recent bugs, which have been fixed). However, in the less
frequently used IEEE 754 directed rounding modes — round toward
positive infinity, round toward negative infinity, and round
toward zero — strtod() gives incorrectly rounded results for
some inputs. Articles from June, 2010 When a decimal number is
converted to a binary floating-point number, the floating-point
number, in general, is only an approximation to the decimal
number. Large integers, and most decimal fractions, require more
significant bits than can be represented in the floating-point
format. This means the decimal number must be rounded, to one of
the two floating-point numbers that surround it. Common practice
considers a decimal number correctly rounded when the nearest of
the two floating-point