positive and negative infinity for integral types in c++ -


i reading positive , negative infinity in c++.

i read integral types dont have infinite value ie. std::numeric_limits<int>::infinity(); wont work, std::numeric_limits<int>::max(); work , represent maximum possible value can represented integral type.

so std::numeric_limits<int>::max(); of integral type taken positive infinite limit ?

or integral type has max value , infinity value not true ?

floating point numbers have special bit pattern indicate "the value infinity", used when result of operation defined infinite.

integer values have set number of bits, , bits used represent numeric value. there no "special bit pattern", it's whatever sum of bit positions mean.

edit: on page 315 of hardcopy of amd64 architecture programmer's manual, says

infinity. infinity positve or negative number +∞ , -∞, in integer bit 1, biased exponent maximum , fraction 0. infintes maximum numbers can represented in floating point format, negative infinity less finite number , positive infinity greater finite number (ie. affine sense).

and infinite result produce when non-zero, non-infinite number divided 0 or multiplied infinity, or when infinity added infinity or 0. arithmetic infinites exact. example, adding floating point number +∞ gives result of +∞ arithmetic comparisons work correctly on infinites. exceptions occur when use of infinity source operand constitutes invalid operation.

(any typing mistakes mine)


Comments

Popular posts from this blog

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -