Feature #1482
Extended rationals: PlusInfinity and MinusInfinity
Description
Might we be interested in having representations of PlusInfinity
and MinusInfinty
?
This could be useful for non-finite intervals. A possible represemtation could be as the "malformed" rationals 1/0
and -1/0
.
Related issues
History
#1 Updated by John Abbott over 3 years ago
- Related to Feature #1176: interval arithmetic added
#2 Updated by John Abbott over 3 years ago
- what type should these values have?
BigRat
? Or MaybeExtendedBigRat
? - We'd probably need functions such as
IsInfinite
- Which operations should work on infinite values? Sign? Comparisons?
- Is
PlusInfinity == PlusInfinity
? - What about arithmetic? Some operations coul reasonably be defined: e.g.
finite + PlusInfinity
should givePlusInfinity
, etc.
It may not be worth it. It could be tricky/tedious putting in all the checks to handle infinities in comparisons, and arithmetic operations...
#3 Updated by John Abbott over 3 years ago
- Status changed from New to In Progress
- % Done changed from 0 to 10
The doc for GMP states fairly clearly that the rationals 1/0
and -1/0
can be created, but that they may not be passed to arithmetic functions.
It is not clear whether they may be used safely in comparison functions; probably we should assume that it is not safe.
#4 Updated by John Abbott over 3 years ago
Maybe the simple approach is to create two new types: PlusInfinityType
and MinusInfinityType
. Then it should be easy to write the special casee functions: e.g. PlusInfinityType operator+(const BigRat&, PlusInfinityType)
Uniform handling inside the interval code might be rather tedious... :-(
#5 Updated by John Abbott 2 months ago
- Target version changed from CoCoALib-0.99850 to CoCoALib-0.99900