Opened 8 months ago

Closed 7 months ago

#12581 closed Feature Requests (fixed)

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:


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 (1)

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

Download all attachments as: .zip

Change History (3)

Changed 8 months ago by Michael Shatz

demonstrates boost atan2() behavior that differs from C RTL

comment:1 Changed 7 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:

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

comment:2 Changed 7 months ago by johnmaddock

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain johnmaddock.
The resolution will be deleted. Next status will be 'reopened'.

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

Note: See TracTickets for help on using tickets.