[llvm-dev] Incorrect return values for APFloat::convertFromString?

Joerg Sonnenberger via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 2 08:02:46 PST 2016


On Wed, Mar 02, 2016 at 03:47:43PM +0000, Mueller-Roemer, Johannes Sebastian via llvm-dev wrote:
> 1.       If I pass the hex representation of the closest value to 0.1
> (0x19999Ap-24), everything is fine and opOk is returned. However, if I
> pass the same value as a decimal string (0.10000002384185791015625),
> opInexact is set.

Well, they are not the same value. The decimal string depends on the
mantissa size and the rounding mode. For the hex version, only the
mantissa size has to be large enough to not require truncation/rounding.

Joerg


More information about the llvm-dev mailing list