floatinf
Floatinf is a term sometimes used to denote the positive infinity value in floating-point arithmetic. It is not a formal standard name, but it appears in codebases and documentation as a shorthand for an unbounded numeric value represented within floating-point formats such as IEEE 754.
In IEEE 754 floating-point systems, positive infinity is encoded as an exponent of all ones with a
- inf plus any finite number yields inf; inf plus inf yields inf.
- inf minus a finite number yields inf; inf minus inf yields NaN.
- inf times a positive finite number yields inf; inf times a negative finite number yields -inf.
- finite divided by inf yields 0; inf divided by finite yields inf; inf divided by inf yields
Positive infinity compares greater than all finite numbers. inf equals itself (inf == inf is true). Comparisons
Many languages provide explicit constants for infinity:
- Python: float('inf') or math.inf
- Java: Double.POSITIVE_INFINITY
- C/C++: INFINITY or std::numeric_limits<double>::infinity()
Infinity serves as a sentinel for unbounded results, overflow handling, or uninitialized yet-reached limits in algorithms.