Re: TLorentzRotation

From: ZVYAGIN (ZVYAGIN@mx.ihep.su)
Date: Sat Feb 19 2000 - 03:42:57 MET


Hi, ALL

On Fri, 18 Feb 2000, Peter Malzacher wrote:
> l.TT() is 'nan' ( = not a number)  i.e underflow or overflow

A small correction here. Yes, "nan" is Not A Number, but "nan" is neither
underflow (minus infinity, -inf) nor overflow (plus infinity, +inf).
Mathematical library (at least under Linux, glibc 2.1) works correctly with 
+/- inf and nan. Try this example:

#include <iostream>
#include <cmath>
int main(void)
{
  float
    inf_m = log(0),  // -inf
    inf_p = -inf_m,  // +inf
    nan   = log(-1); // or sqrt(-1);
  cout.form("infinites     (inf): %g %g %g %g %g\n",
             inf_m,inf_p,inf_m+inf_p, 1/inf_m, exp(inf_m));
  cout.form("not a numbers (nan): %g %g %g %g\n",nan,-nan,1/nan,0*nan);
}

The output is:
infinites     (inf):    -inf inf nan -0 0
not a numbers (nan):    nan nan nan nan

And remember that this example do not use complex numbers!


Here is "man finite":

       isinf,  isnan,  finite - test for infinity or not-a-number
       (NaN)

SYNOPSIS
       #include <math.h>

       int isinf(double value);

       int isnan(double value);

       int finite(double value);

DESCRIPTION
       The isinf() function returns -1 if value represents  nega-
       tive  infinity,  1  if value represents positive infinity,
       and 0 otherwise.

       The isnan() function returns a non-zero value if value  is
       "not-a-number" (NaN), and 0 otherwise.

       The finite() function returns a non-zero value if value is
       neither infinite nor a "not-a-number" (NaN) value,  and  0
       otherwise.

CONFORMING TO
       BSD 4.3


 ---- End of man page ----

Note, these functions do NOT confirm POSIX, so use it carefully in 
portable applications!

With best wishes,
Alexander Zvyagin.



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET