Anonymous  Login  20240614 13:28 UTC 
Main  My View  View Issues  Change Log  Docs 
Viewing Issue Simple Details [ Jump to Notes ]  [ Issue History ] [ Print ]  
ID  Category  Severity  Type  Date Submitted  Last Update  
0001503  [Issue 8 drafts] Base Definitions and Headers  Editorial  Enhancement Request  20210807 20:59  20240611 09:12  
Reporter  andras_farkas  View Status  public  
Assigned To  
Priority  normal  Resolution  Accepted As Marked  
Status  Closed  Product Version  
Name  Andras Farkas  
Organization  
User Reference  
Section  math.h  
Page Number  
Line Number  
Final Accepted Text  Note: 0005541  
Summary  0001503: Potential new M_ constants for math.h  
Description 
There may be five useful new M_ constants to be included in the math.h header. The latest standard for C++, known as C++20, introduces a header called <numbers>, which contains many math constants, and is similar in intent to XSI's M_ constants in math.h. There's lots of overlap, but the list of M_ constants and list of constants in <numbers> do differ. Constants in both XSI and <numbers>: M_E, e M_LOG2E, log2e M_LOG10E, log10e M_LN2, ln2 M_LN10, ln10 M_PI, pi M_1_PI, inv_pi M_SQRT2, sqrt2 Constants only in XSI: M_PI_2 M_PI_4 M_2_PI M_2_SQRTPI M_SQRT1_2 Constants only in <numbers>: inv_sqrtpi (1 divided by the square root of pi, approximately 0.5641) sqrt3 (Square root of 3, approximately 1.7320) inv_sqrt3 (1 divided by the square root of 3, approximately 0.5773) egamma (EulerMascheroni constant, approximately 0.5772) phi (golden ratio, approximately 1.6180) References: XSI: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html [^] C++20 draft standard (specifically section 26.9, page 1224): https://isocpp.org/files/papers/N4860.pdf [^] P0631R8 Math Constants (The original paper on <numbers>): http://www.openstd.org/jtc1/sc22/wg21/docs/papers/2019/p0631r8.pdf [^] Notably, this paper references XSI. I'm not a mathematician, so I'm not sure whether adding those five new constants from <numbers> would be considered useful, or considered clutter. Please chime in. Personally, I've only ever used M_PI out of all the M_ constants, but I'm glad it's there when I do use it, and I'm glad all the constants are there. 

Desired Action 
I'd like for people to examine the usefulness of the five new constants. If they're judged useful: Add to the section on math.h, immediately after the other M_ constants (or interspersed with them), and also XSImarked: M_1_SQRTPI Value of 1/sqrt(pi) M_SQRT3 Value of sqrt(3) M_1_SQRT3 Value of 1/sqrt(3) M_EGAMMA Value of [lowercase gamma], EulerMascheroni constant M_PHI Value of [lowercase phi], ( (1 + sqrt(5))/2 ), golden ratio constant Of course, the "Value of" text would use more fitting symbols than I was able to use here, for the values. 

Tags  issue8  
Attached Files  

Notes  
(0005430) andras_farkas (reporter) 20210807 21:32 
Actually, there could be some changes to my desired action proposal. M_1_SQRT3 should certainly be M_SQRT1_3 in order to match M_SQRT1_2 M_1_SQRTPI could also be M_SQRT1_PI to match. 
(0005431) andras_farkas (reporter) 20210807 21:41 
Thus, desiring to be consistent with the standard as it already exists, this is my new desired action: Add to the section on math.h, immediately after the other M_ constants (or interspersed with them), and also XSImarked: M_SQRT1_PI Value of 1/sqrt(pi) M_SQRT3 Value of sqrt(3) M_SQRT1_3 Value of 1/sqrt(3) M_EGAMMA Value of [lowercase gamma], EulerMascheroni constant M_PHI Value of [lowercase phi], ( (1 + sqrt(5))/2 ), golden ratio constant 
(0005541) geoffclare (manager) 20211202 17:24 edited on: 20211202 17:39 
Add the requested new M_ symbolic constants to <math.h> using the names in Note: 0005431 in an order determined by the editor all with XSI shading. Also add XSI shading to (2018 edition) P288, L97459746 and extend the shading down to L9759 (as a single shading block). 
(0005598) geoffclare (manager) 20220113 10:13 
While applying this bug, on seeing the updated list with the additions in place, I decided it made more sense to add the name M_1_SQRTPI from the Desired Action, instead of M_SQRT1_PI, so that it forms a consistent set with M_1_PI, M_2_PI, and M_2_SQRTPI. 
Issue History  
Date Modified  Username  Field  Change 
20210807 20:59  andras_farkas  New Issue  
20210807 20:59  andras_farkas  Name  => Andras Farkas 
20210807 20:59  andras_farkas  Section  => math.h 
20210807 21:32  andras_farkas  Note Added: 0005430  
20210807 21:41  andras_farkas  Note Added: 0005431  
20211202 17:24  geoffclare  Note Added: 0005541  
20211202 17:25  geoffclare  Final Accepted Text  => Note: 0005541 
20211202 17:25  geoffclare  Status  New => Resolved 
20211202 17:25  geoffclare  Resolution  Open => Accepted As Marked 
20211202 17:25  geoffclare  Tag Attached: issue8  
20211202 17:39  geoffclare  Note Edited: 0005541  
20220113 10:13  geoffclare  Note Added: 0005598  
20220113 10:13  geoffclare  Status  Resolved => Applied 
20240611 09:12  agadmin  Status  Applied => Closed 
Mantis 1.1.6[^] Copyright © 2000  2008 Mantis Group 