This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 18/numeric_limits fail on solaris 2.8


>I'm having a look at this failure on solaris and many things look very 
>strange to me. The following is line 91, the first assert failing:
>
> > VERIFY( (extrema_max - limits_max) < (1 + epsilon) );
>
> I suppose there is a typo in your transcript, right? ;-)
> Because I have:
>
> VERIFY( (extrema_min - limits_min) < epsilon );
> VERIFY( (limits_min - extrema_min) < epsilon );
> VERIFY( (extrema_max / limits_max) < (1 + epsilon) );
> VERIFY( (limits_max / extrema_max) < (1 + epsilon) );

They didn't match because I fixed Benjamin's minor typo before you
looked at it...  ;-)  In any event, please note that none of that code
is even exercised on Solaris:

#ifdef __FreeBSD__
// This specialization allows the extra precision unmentioned in
// system headers yet supported by long double on FreeBSD or Solaris
// to not cause a gratuitous FAIL for the entire test.  Using this
// technique to compare the residual against epsilon ensures that any
// major breakage will still be detected (although obviously not as
// tight as the exact equality check that would have been generated by
// default).  This replacement test is allowable by the fact that C++
// limits should match the system provided limits for C even if they
// were wrong verses the actual FP hardware.
template<>
void test_extrema<long double>()
{
  typedef long double T;
  bool test = true;
  T limits_min = std::numeric_limits<T>::min();
  T limits_max = std::numeric_limits<T>::max();
  T extrema_min = extrema<T>::min;
  T extrema_max = extrema<T>::max;
  T epsilon = std::numeric_limits<T>::epsilon();
  VERIFY( (extrema_min - limits_min) < epsilon );
  VERIFY( (limits_min - extrema_min) < epsilon );
  VERIFY( (extrema_max / limits_max) < (1 + epsilon) ); # line 91
  VERIFY( (limits_max / extrema_max) < (1 + epsilon) );
}
#endif

How the heck is line 91 even coming into play on Solaris?

Closely reading the above comment (which I wrote) makes me think that
it should be...  I am almost sure that when I posted the patch that
added that specialization, I begged a solaris person to enable it
after verifying the situation I found.  I am sorry if I dropped the
ball on a port I barely use (which is why I wanted someone else to
authoritatively enable it on a as-needed basis).

Regards,
Loren
-- 
Loren J. Rittle
Senior Staff Software Engineer, Distributed Object Technology Lab
Networks and Infrastructure Research Lab (IL02/2240), Motorola Labs
rittle@rsch.comm.mot.com, KeyID: 2048/ADCE34A5, FDC0292446937F2A240BC07D42763672


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]