[Insight-users] Re: Hello- Guidance regarding using Infinity

Luis Ibanez luis.ibanez at kitware.com
Wed Mar 21 08:21:29 EST 2007


Hi Sonali,

You may want to try the following option:


    double Infinity;
    if( vcl_numeric_limits<double>::has_infinity )
      {
      Infinity =
         vcl_numeric_limits< double >::infinity();
      }
    else
      {
      Infinity = itk::NumericTraits< double >::max();
      }

I assume that you are looking for the "infinity"
value for the "double" type. If not, then, replace
"double" in the code above, with the type that you
are interested on.


   Regards,


      Luis


----------------------
Sonali Barua wrote:
> Hello,
> 
> I tried using this definition of Infinity but it doesn't seem to work. 
> Is there an alternative?
> 
> Sonali
> 
> On 10/30/06, *Luis Ibanez* <luis.ibanez at kitware.com 
> <mailto:luis.ibanez at kitware.com>> wrote:
> 
>     Hi Sonali,
> 
>     ITK NumericTraits inherit their definition of max() from VXL.
> 
>     You will find the definition in the file:
> 
>              Insight/Utilities/vxl/vcl/emulation/
>                                            vcl_limits.h
> 
> 
>     in line 542:
> 
> 
>        inline static double max() { return 1.7976931348623157e+308; }
> 
> 
> 
>        Regards,
> 
> 
>            Luis
> 
> 
>     -------------------
>     Sonali Barua wrote:
>      > What would the return type be? I can't seem to find the
>     definition of
>      > this value online.
>      >
>      > On 6/17/06, *Luis Ibanez* < luis.ibanez at kitware.com
>     <mailto:luis.ibanez at kitware.com>
>      > <mailto:luis.ibanez at kitware.com
>     <mailto:luis.ibanez at kitware.com>>> wrote:
>      >
>      >
>      >     Hi Sonali,
>      >
>      >     The closest equivalent to "INFINITY" in Generic Programming
>      >     is the value of:
>      >
>      >
>      >                itk::NumericTraits< double >::max();
>      >
>      >
>      >     Regards,
>      >
>      >
>      >         Luis
>      >
>      >
>      >     ---------------------
>      >     Sonali Barua wrote:
>      >      > Hello,
>      >      >
>      >      > I am trying to develop a Graph Class for ITK. I would like to
>      >     know what
>      >      > pre defined variable in ITK I can use to define INFINITY.
>      >      >
>      >      > Sincerely,
>      >      >
>      >      > Sonali Barua.
>      >
>      >
>      >
> 
> 


More information about the Insight-users mailing list