Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] LDBL_MANT_DIG declaration trouble
From: Ray Sheppard (rsheppar_at_[hidden])
Date: 2013-04-12 10:09:09


Hi,
   I am sorry to bother everyone. I have had no trouble building 1.6.3
with the Intel compiler. Now I am having to repeat the exercise for
GNU. In opal/util/arch.h (about line 260) is the function below. I am
getting an error that LDBL_MANT_DIG is not declared. I can not seem to
find where it is declared. Any hints would be appreciated. Thanks.
                                          Ray

static inline int32_t opal_arch_ldisintel( void )
{
     long double ld = 2.0;
     int i, j;
     uint32_t* pui = (uint32_t*)(void*)&ld;

     j = LDBL_MANT_DIG / 32;
     i = (LDBL_MANT_DIG % 32) - 1;
     if( opal_arch_isbigendian() ) { /* big endian */
         j = (sizeof(long double) / sizeof(unsigned int)) - j;
         if( i < 0 ) {
             i = 31;
             j = j+1;
         }
     } else {
         if( i < 0 ) {
             i = 31;
             j = j-1;
         }
     }
     return (pui[j] & (1 << i) ? 1 : 0);
}

Function is described:
/* we must find which representation of long double is used
  * intel or sparc. Both of them represent the long doubles using a close to
  * IEEE representation (seeeeeee..emmm...m) where the mantissa look like
  * 1.????. For the intel representaion the 1 is explicit, and for the sparc
  * the first one is implicit. If we take the number 2.0 the exponent is 1
  * and the mantissa is 1.0 (the sign of course should be 0). So if we check
  * for the first one in the binary representation of the number, we will
  * find the bit from the exponent, so the next one should be the begining
  * of the mantissa. If it's 1 then we have an intel representaion, if not
  * we have a sparc one. QED
  */