Boost logo

Boost Users :

Subject: Re: [Boost-users] deleting operators to forbid mixed arithmetic? [multiprecision]
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2017-08-14 08:49:21


 

 

From: Boost-users [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Dani Brake via Boost-users
Sent: 13 August 2017 18:39
To: boost-users_at_[hidden]
Cc: Dani Brake
Subject: Re: [Boost-users] deleting operators to forbid mixed arithmetic? [multiprecision]

 

So in principle you just define a full or partial specialization, for example:
template <class Backend>
struct is_compatible_arithmetic_type<double, number<Backend> > : public mpl::false_ {};
and then cross your fingers and hope for the best ;)

 

Thanks for the suggestion, i'll give it a try. \e crosses fingers

 

Putting a macro bracket around this might make it generally useful, perhaps something like:

 

#ifdef BOOST_MULTIPRECISION_NO_DOUBLE_OPS (BUILTIN_OPS would include float and long double?)

 

…

 

template <class Backend>
struct is_compatible_arithmetic_type<double, number<Backend> > : public mpl::false_ {};

 

say

#endif

 

If you find this useful, you could create a GIT Pull Request, or just email the file changed. You won’t be the only one J. Defining the macro BOOST_MULTIPRECISION_NO_DOUBLE_OPS could be a way to detect dodgy conversions that need to be changed to keep full precision.

 

Good luck

 

Paul

 

---
Paul A. Bristow
Prizet Farmhouse
Kendal UK LA8 8AB
+44 (0) 1539 561830
 
 
 
 
 



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