|
Boost : |
Subject: Re: [boost] Looking for some "real world" extended precision integer arithmetic tests
From: Andrii Sydorchuk (sydorchuk.andriy_at_[hidden])
Date: 2012-01-24 18:45:03
Hi John,
I was almost done implementing benchmark with fixed_int and voronoi library
when next problem appeared.
Let's consider following code snippet:
#include <iostream>
#include "boost/multiprecision/fixed_int.hpp"
using namespace boost::multiprecision;
template <typename T>
void foo(const T& that) {
std::cout << "Using default foo." << std::endl;
}
template <>
void foo<mp_int512_t>(const mp_int512_t& that) {
std::cout << "Using fixed_int specialization." << std::endl;
}
int main() {
mp_int512_t a = 1;
mp_int512_t b = 2;
foo(a); // outputs 'Using fixed_int specialization.'
foo(a * b); // outputs 'Using default foo.'
return 0;
}
I understand the reason of such behaviour (results of the expressions are
stored as some intermediate objects), but in my implementation I need to
specify template function specialization that converts fixed_int to
double. Any suggestions on how to fix this?
Regards,
Andrii
On Tue, Jan 24, 2012 at 10:31 PM, Christopher Kormanyos
<e_float_at_[hidden]>wrote:
> > ... So I'd be really interested to put the type through it's paces with
> some real world code that really thrashes an extended precision integer
> type. Any suggestions? Anything in Boost?
>
> > Thanks in advance, John.
>
> Ooooops. Disregard my last post. You want integer tests
> and I suggested a float.
>
> Best regards, Chris.
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk