Boost logo

Boost :

From: SourceForge.net (noreply_at_[hidden])
Date: 2005-07-27 16:46:54


Bugs item #1246358, was opened at 2005-07-27 14:46
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1246358&group_id=7586

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: interval evaluation bug

Initial Comment:
evaluation of sin of [0,1] with interval template
specification

typedef boost::numeric::interval<
                double,
                boost::numeric::interval_lib::policies<
                        boost::numeric::interval_lib::
save_state<
                                boost::numeric::interval_lib::
rounded_transc_exact<double,
                                        boost::numeric::
interval_lib::rounded_arith_opp<double>
>
>,
                        boost::numeric::interval_lib::
checking_strict<double>
                        //boost::numeric::interval_lib::
checking_base<double>
>
> Interval;

and rint definition in ms Windows

static double inline rint( double x)
// Copyright (C) 2001 Tor M. Aamodt, University of
Toronto
// Permisssion to use for all purposes commercial and
otherwise granted.
// THIS MATERIAL IS PROVIDED "AS IS" WITHOUT
WARRANTY, OR ANY CONDITION OR
// OTHER TERM OF ANY KIND INCLUDING, WITHOUT
LIMITATION, ANY WARRANTY
// OF MERCHANTABILITY, SATISFACTORY QUALITY,
OR FITNESS FOR A PARTICULAR
// PURPOSE.
{
    if( x > 0 ) {
        __int64 xint = (__int64) (x+0.5);
        if( xint % 2 ) {
            // then we might have an even number...
            double diff = x - (double)xint;
            if( diff == -0.5 )
                return double(xint-1);
        }
        return double(xint);
    } else {
        __int64 xint = (__int64) (x-0.5);
        if( xint % 2 ) {
            // then we might have an even number...
            double diff = x - (double)xint;
            if( diff == 0.5 )
                return double(xint+1);
        }
        return double(xint);
    }
}

gives incorrect result:
so sin([0,1]) = [ 0.841471 , -1.60814e-016 ]

Thats looks incredible!!! How can i fix it out?

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1246358&group_id=7586

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO September
19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Boost-bugs mailing list
Boost-bugs_at_[hidden]
https://lists.sourceforge.net/lists/listinfo/boost-bugs


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk