#12581 closed Feature Requests (fixed)

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

Reported by: Michael Shatz Owned by: John Maddock
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 17 months ago.
demonstrates boost atan2() behavior that differs from C RTL

Download all attachments as: .zip

Change History (3)

Changed 17 months ago by Michael Shatz

Attachment: af_p4.cpp added

demonstrates boost atan2() behavior that differs from C RTL

comment:1 Changed 16 months ago by John Maddock

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 16 months ago by John Maddock

Resolution: fixed
Status: newclosed

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.