Modify

Ticket #12625 (closed Bugs: fixed)

Opened 5 months ago

Last modified 5 months ago

multiprecision acos() sometimes does not return

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

Description

Thibaut Paumard reported the following bug to Debian as https://bugs.debian.org/844495

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;
  alpha100=5.9839860068377014046259e-02;
  b=cos(alpha100);
  a=acos(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

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

Change History

Changed 5 months ago by steve@…

patch for bug

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

  • Cc thibaut@… added

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

Hi,

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> >
    zero("0.");

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

  return 0;
}

Kind regards, Thibaut.

comment:3 Changed 5 months ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed

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:

https://github.com/boostorg/multiprecision/commit/138a9055e2edc68dca2e78ff97ffe6276c17fa0a https://github.com/boostorg/multiprecision/commit/26ceb6ef386f5fb879ddccca59cc3bdc57c124f3 https://github.com/boostorg/multiprecision/commit/c0df5b6747d09268256b59501c3cab746112268e

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.