#12625 closed Bugs (fixed)

multiprecision acos() sometimes does not return

Reported by: steve@… Owned by: John Maddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.62.0 Severity: Problem
Keywords: Cc: steve@…, thibaut@…


Thibaut Paumard reported the following bug to Debian as

Some inputs cause multiprecision acos() to hang. The following example hangs on s390x:

#include <boost/multiprecision/cpp_dec_float.hpp>

int main(int argc, char** argv) {

  boost::multiprecision::cpp_dec_float_100 alpha100, a, b;

  return 0;

Known affected architectures include arm64 armel armhf mips64el mipsel ppc64el s390x powerpc ppc64. It's not clear to me whether the value of alpha100 needs to be adjusted to trigger the bug on different architectures.

Thibaut has proposed the attached patch. Would appreciate knowing the maintainer's thoughts about the patch.

Attachments (1)

no-fp-ilogb0 (1.4 KB) - added by steve@… 16 months ago.
patch for bug

Download all attachments as: .zip

Change History (4)

Changed 16 months ago by steve@…

Attachment: no-fp-ilogb0 added

patch for bug

comment:1 Changed 16 months ago by Thibaut Paumard <thibaut@…>

Cc: thibaut@… added

comment:2 Changed 16 months ago by Thibaut Paumard <thibaut@…>


Although I haven't yet been able to demonstrate that acos() can hang on amd64, I confirm that ilogb(zero) is also 0 for a multiprecision zero on this architecture, therefore comparing it to FP_ILPOGB0 does not make sense:

#include <iostream>
#include <boost/multiprecision/cpp_dec_float.hpp>

int main(int argc, char** argv) {

  boost::multiprecision::number<boost::multiprecision::cpp_dec_float<100> >

  std::cout << ilogb(zero) << std::endl;
  std::cout << FP_ILOGB0 << std::endl;

  return 0;

Kind regards, Thibaut.

comment:3 Changed 16 months ago by John Maddock

Resolution: fixed
Status: newclosed

The attached patch fixes things for cpp_dec_float, but completely breaks other types in the library (as you would quickly discover running the regression tests). This is now fixed in develop in a series of commits:

These mostly relate to issue #12581 but fix this one as well.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.