|
Boost : |
Subject: Re: [boost] questions about boost multiprecision
From: John Maddock (jz.maddock_at_[hidden])
Date: 2019-03-22 09:47:16
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_multiprecision/tut/ints/cpp_int.html
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk