Infinity and Undefined

Douglas Gregor gregod at cs.rpi.edu
Fri Nov 2 22:17:19 CET 2001


Hello all,
  I'm currently extending GiNaC to be used for symbolic range propagation. 
While the specifics of the extensions are likely not interesting to most 
users, I do find that I need to handle both Infinite and Undefined values in 
a sensible manner. I'll describe the approach I've taken thus far and would 
appreciate feedback.
  
  Including Infinity and Undefined within GiNaC seems to weed its way into 
many areas of the code. For instance, when we have two expair's x and y, we 
assume that if x->rest == y->rest we can combine the coefficients. Clearly 
this doesn't hold when we consider Infinity or Undefined, so we end up with a 
large number of special-case branches when we see Infinity or Undefined in an 
expression. This happens in quite a few places.

  My current approach is to defined GiNaC::constant values for Infinity and 
Undefined, and include functions to quickly check if an expression is the 
Infinity or Undefined constant. From there we just need to find all of the 
required special cases...

  Again, and feedback would be appreciated. I've only been using GiNaC for a 
short while, and perhaps there are tricks that could make this addition go 
more smoothly.

  Doug Gregor
  gregod at cs.rpi.edu





More information about the GiNaC-devel mailing list