Modify

Ticket #12581 (closed Feature Requests: fixed)

Opened 6 months ago

Last modified 5 months ago

cpp_bin_float: Anal fixation. Part 4. Special cases of atan2()

Reported by: Michael Shatz Owned by: johnmaddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.62.0 Severity: Cosmetic
Keywords: atan2 Cc:

Description

In following special cases boost::atan2(y, x) return values are different from C RTL:

  y     x  C RTL  boost
 inf  inf  pi/4   nan
-inf  inf -pi/4   nan
 inf -inf  3*pi/4 nan
-inf -inf -3*pi/4 nan
-0   -val -pi     pi
 0    nan  nan    0
 inf  nan  nan    pi/2
-inf  nan  nan   -pi/2

The first four boost answer make sense. IMHO, they are better than C RTL answers. The fifth boost answer is strange, but can be considered acceptable. The rest are plain bugs - nan should always propagate.

Attachments

af_p4.cpp (1.4 KB) - added by Michael Shatz 6 months ago.
demonstrates boost atan2() behavior that differs from C RTL

Change History

Changed 6 months ago by Michael Shatz

demonstrates boost atan2() behavior that differs from C RTL

comment:1 Changed 5 months ago by johnmaddock

This is basically fixed in this giant commit which tries to bring all the functions into line with C99 annex F: https://github.com/boostorg/multiprecision/commit/138a9055e2edc68dca2e78ff97ffe6276c17fa0a

I might need to do some more work on this, especially for types other than cpp_bin_float.

comment:2 Changed 5 months ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed
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.