Stable infinity value in Panda3D

This may be more of a Python question than a Panda3D question, but I’ll give it a shot.

Is there a reliable way to generate the ‘infinite’ float value #INF in Panda3D, such as a constant definition? I’m writing a min-maxing algorithm that needs initial conditions. I’ve been using the hack of 1e300000 for awhile, but I just discovered it’s not stable; sometimes it will give me #INF, other times it will collapse to 1.0 (?!?!?!?).

Any help on this issue would be greatly appreciated! For now, I’ll have to use 1e300 and just accept that sufficiently large things will break my algorithm.

Take care,

There appears to be a Python Enhancement Proposal currently pending which deals with this very issue:

Until this proposal is accepted, however, it appears that the answer is “it’s not really portable.”

It’s probably possible to write your algorithm so that you don’t rely on having reference to an infinite value. For instance, if you are computing the minimum value of a list, start with the first value in the list, instead of starting with infinity.