questions about boost multiprecision
I'm looking more carefully at Boost Multiprecision than I have in the past and have a couple of questions: It's not clear to me how errors are handled. For example, what happens in a divide by zero? Or what happens when a result overflows. I'm aware that this will likely vary depending on whether the arguments are arbitrary precision made a runtime or a precision fixed at compile time. In any case, looking through the manual I can't find this information. Of course this package is so ambitious, that it's possible that I've missed it but in that case a pointer would be appreciated. Spending some time on this makes me appreciate what an incredibly ambitious accomplishment this is. It's really unbelievable. I would be curious how frequently various parts of the package are used. Robert Ramey
AMDG On 3/21/19 4:44 PM, Robert Ramey via Boost wrote:
I'm looking more carefully at Boost Multiprecision than I have in the past and have a couple of questions:
It's not clear to me how errors are handled. For example, what happens in a divide by zero?
std::overflow_error. This is documented for the individual backends.
Or what happens when a result overflows.
It depends on the specific type. cpp_int describes what it does here: https://www.boost.org/libs/multiprecision/doc/html/boost_multiprecision/tut/...
I'm aware that this will likely vary depending on whether the arguments are arbitrary precision made a runtime or a precision fixed at compile time. In any case, looking through the manual I can't find this information. Of course this package is so ambitious, that it's possible that I've missed it but in that case a pointer would be appreciated.
Spending some time on this makes me appreciate what an incredibly ambitious accomplishment this is. It's really unbelievable. I would be curious how frequently various parts of the package are used.
In Christ, Steven Watanabe
-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Robert Ramey via Boost Sent: 21 March 2019 22:44 To: boost@lists.boost.org Cc: Robert Ramey Subject: [boost] questions about boost multiprecision
I'm looking more carefully at Boost Multiprecision than I have in the past and have a couple of questions:
It's not clear to me how errors are handled. For example, what happens in a divide by zero? Or what happens when a result overflows. I'm aware that this will likely vary depending on whether the arguments are arbitrary precision made a runtime or a precision fixed at compile time. In any case, looking through the manual I can't find this information. Of course this package is so ambitious, that it's possible that I've missed it but in that case a pointer would be appreciated.
Someone with superior knowledge has already answered your main query. Google 'knew'. (It does reveal that the auto-indexing needs manual help - trying https://www.boost.org/doc/libs/1_69_0/libs/multiprecision/doc/html/boost_mul... does not yield any references to overflow :-( ) None of our documentation tools has yet to solve this sort of need well.
Spending some time on this makes me appreciate what an incredibly ambitious accomplishment this is. It's really unbelievable. I would be curious how frequently various parts of the package are used.
But I can also assure you from some buglets that have crept out of the woodwork, that some people are making surprisingly sophisticated use of this package. Paul --- Paul A. Bristow Prizet Farmhouse Kendal UK LA8 8AB +44 (0) 1539 561830
On 21/03/2019 22:44, Robert Ramey via Boost wrote:
I'm looking more carefully at Boost Multiprecision than I have in the past and have a couple of questions:
It's not clear to me how errors are handled. For example, what happens in a divide by zero?
As Stephen says, "it depends". Most of the floating point and complex types have infinity and NaN support so they behave just like regular floating point types. Integer types are all overflow_error's for division by zero - each type has a "things you should know when using this" section that documents all this stuff, for example at https://www.boost.org/doc/libs/1_66_0/libs/multiprecision/doc/html/boost_mul... for cpp_int. There are other errors that may be signalled at runtime, especially with the "checked" integers. More on the page linked above.
Or what happens when a result overflows. I'm aware that this will likely vary depending on whether the arguments are arbitrary precision made a runtime or a precision fixed at compile time. In any case, looking through the manual I can't find this information. Of course this package is so ambitious, that it's possible that I've missed it but in that case a pointer would be appreciated.
Spending some time on this makes me appreciate what an incredibly ambitious accomplishment this is. It's really unbelievable. I would be curious how frequently various parts of the package are used.
Aren't we all ;) I know that we get a steady stream of bug reports and feature requests, so on that basis someone is using it.... if I had to guess, we're mostly used by students/educators/academic types, but that's sort of the target audience anyway: casual, easy to use, big numbers. The crypto folks need rather more specialist code, as do the folks using super-large digit counts for number hunting. The only large scale project I know of using this is the Ethereum project (https://www.ethereum.org/), again because they're active in providing feedback. John. --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
On 3/22/19 2:47 AM, John Maddock via Boost wrote:
Spending some time on this makes me appreciate what an incredibly ambitious accomplishment this is. It's really unbelievable. I would be curious how frequently various parts of the package are used.
Aren't we all ;)
Nope - I've advocated on multiple occasions for a boost effort to determine frequency of library use, libraries desired by the user community, etc. This would give us an idea what kinds of projects we should promote via GSOC, C++Now talks, etc and which projects we might consider deprecating etc. But These efforts have always resulted in push back from a large number of people who think this is a bad idea or wast of time. I personally fail to understand this. I'm still thinking about this. Having spent more time with multi-precision, I'm only now aware of the (sort of) overlap with some aspects of safe numerics. This opens up a whole new can of worms in my brain. Robert Ramey
participants (4)
-
John Maddock
-
Paul A. Bristow
-
Robert Ramey
-
Steven Watanabe