[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [lmi] Unit test for C99 round()
From: |
Vadim Zeitlin |
Subject: |
Re[2]: [lmi] Unit test for C99 round() |
Date: |
Wed, 4 Jun 2008 21:30:56 +0200 |
On Wed, 04 Jun 2008 15:22:33 +0000 Greg Chicares <address@hidden> wrote:
GC> So I'd guess the problem must have something to do with whether
GC> detail::perform_rint() gets called in this block, because that's
GC> the only place it seems to be used:
GC>
GC> // Choose the auxiliary rounding function indicated by the argument.
GC> template<typename RealType>
GC> typename round_to<RealType>::rounding_function_t
GC> round_to<RealType>::select_rounding_function(rounding_style const a_style)
const
GC> {
GC> #ifndef LMI_LACKING_RINT_OR_EQUIVALENT
GC> if
GC> ( a_style == default_rounding_style()
GC> && a_style != r_indeterminate
GC> )
GC> {
GC> return detail::perform_rint;
GC> }
GC> #endif // not defined LMI_LACKING_RINT_OR_EQUIVALENT
GC>
GC> If you change that thus:
GC> - return detail::perform_rint;
GC> + // EXPERIMENTALLY SKIPPED return detail::perform_rint;
GC> to suppress that early exit (which should be a mere speed
GC> optimization), then does everything work?
Yes, indeed, thanks for localizing the problem!
However I still don't really know what's going on: the function code looks
to be correct:
Dump of assembler code for function _ZN6detail12perform_rintIfEET_S1_:
0x000000000040c7ee: push %rbp
0x000000000040c7ef: mov %rsp,%rbp
0x000000000040c7f2: movss %xmm0,0xfffffffffffffffc(%rbp)
0x000000000040c7f7: flds 0xfffffffffffffffc(%rbp)
0x000000000040c7fa: frndint
0x000000000040c7fc: fstps 0xfffffffffffffffc(%rbp)
0x000000000040c7ff: mov 0xfffffffffffffffc(%rbp),%eax
0x000000000040c802: mov %eax,0xfffffffffffffff4(%rbp)
0x000000000040c805: movss 0xfffffffffffffff4(%rbp),%xmm0
0x000000000040c80a: leaveq
0x000000000040c80b: retq
End of assembler dump.
however it returns "-0" instead of the expected "-1e-15" when rounding
"-5.00000002e-16" to 15 decimals downwards (this is the first error).
Does this give you any useful information or should I try to look into
this closer myself?
Thanks,
VZ
- [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/03
- Re: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/03
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/03
- Re[2]: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/03
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/03
- Re[2]: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/04
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/04
- Re[2]: [lmi] Unit test for C99 round(),
Vadim Zeitlin <=
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/04
- Re[2]: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/05
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/06
- Re[2]: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/12
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/17
- Re: [lmi] Unit test for C99 round(), Greg Chicares, 2008/06/04
- Re[2]: [lmi] Unit test for C99 round(), Vadim Zeitlin, 2008/06/05