// ---------------------------------------------------------------------- // // inf_ldbl.cc - Does the long double infinity() work properly? // // History: // 23-May-2000 WEB Initial draft // 05-Mar-2001 WEB Accumulate all test results before returning; // 25-Apr-2001 WEB s//"ISOcxx\/ISOcxxSyntax.hh"/ // add volatile testing // // ---------------------------------------------------------------------- #include "ISOcxx/ISOcxxSyntax.hh" #include int main() { int result = 0; #ifndef DEFECT_INF_LONG_DOUBLE /* compliant */ { long double inf = std::numeric_limits::infinity(); if ( 1.1L * inf != inf ) result += 1; if ( inf != 1.1L * inf ) result += 2; if ( 1.1L * inf == inf && inf == 1.1L * inf ) ; else result += 4; } { volatile long double inf = std::numeric_limits::infinity(); volatile long double OnePtOne = 1.1L; if ( OnePtOne * inf != inf ) result += 8; if ( inf != OnePtOne * inf ) result += 16; if ( OnePtOne * inf == inf && inf == OnePtOne * inf ) ; else result += 32; } #endif return result; } // main()