Anonymous  Login  20210917 20:20 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  20210807 21:41  
Reporter  andras_farkas  View Status  public  
Assigned To  
Priority  normal  Resolution  Open  
Status  New  Product Version  
Name  Andras Farkas  
Organization  
User Reference  
Section  math.h  
Page Number  
Line Number  
Final Accepted Text  
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  No tags attached.  
Attached Files  

Mantis 1.1.6[^] Copyright © 2000  2008 Mantis Group 