Boost logo

Boost Users :

From: Ovanes Markarian (om_boost_at_[hidden])
Date: 2008-01-29 03:25:34


Seven,

thanks a lot for pointing it out. That was a classical error!! :(

Anyway I re-ran the test, with corrected accumulate calls:

corrected calls:
array_type::value_type sum_carr_accumulate(array_type const& a)
{
    return std::accumulate(a.begin(), a.end(), 0.0);
}

array_type::value_type sum_arr_copy_accumulate(array_type const& a)
{
    return std::accumulate(a.begin(), a.end(), 0.0);
}

Results (which would be expected from std lib ;)

Running each test 4294967295 of times:
--------------------------
sum_arr_copy
64.79 s

result: 2.84756e+10
--------------------------
sum_carr
14.91 s

result: 2.84756e+10
--------------------------
sum_arr_copy_accumulate
14.91 s

result: 2.84756e+10
--------------------------
sum_carr_temp_result
14.91 s

result: 2.84756e+10
--------------------------
sum_carr_accumulate
14.91 s

result: 2.84756e+10
--------------------------
sum_doubles_copy
15.00 s

result: 2.84756e+10
--------------------------
sum_doubles_copy_optimized
14.96 s

result: 2.84756e+10
--------------------------
sum_doubles_copy_temp_result
14.92 s

result: 2.84756e+10
--------------------------
sum_doubles_ref_temp_result
14.97 s

result: 2.84756e+10
tests done

Regards,
Ovanes

On Jan 29, 2008 5:42 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:

> AMDG
>
> Ovanes Markarian wrote:
> > array_type::value_type sum_carr_accumulate(array_type const& a)
> > {
> > return std::accumulate(a.begin(), a.end(), 0);
> > }
> >
> > array_type::value_type sum_arr_copy_accumulate(array_type const& a)
> > {
> > return std::accumulate(a.begin(), a.end(), 0);
> > }
> >
>
> > Please take a look, that accumulate produced wrong result.
>
> Of course. The results are being collected in an int...
>
> In Christ,
> Steven Watanabe
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net