python - Possible to have ``a < b and not(a - b < 0)`` with floats -


is

a < b , not(a - b < 0)

possible floating points due floating point round of error? there example?

it depends on floating point format, , whether has gradual underflow. ieee 754 binary floating point does. means gap between 2 distinct floats non-zero, if can represented 1 significant bit in extreme case.

the smallest possible absolute difference between 2 distinct floats comes equal sign (or 1 of numbers zero), 0 exponent, , significands differ 1. in case, subtracting larger smaller result in smallest magnitude negative number, negative sign, 0 exponent, , significand 1. number compares less zero.

there other calculations underflow zero. example, dividing smallest positive number number greater or equal 2 results in 0 in normal rounding mode.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -