Austin Group Defect Tracker

Aardvark Mark IV


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 2021-08-07 20:59 2022-01-13 10:13
Reporter andras_farkas View Status public  
Assigned To
Priority normal Resolution Accepted As Marked  
Status Applied   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 (Euler-Mascheroni 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.open-std.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 XSI-marked:
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 [lower-case gamma], Euler-Mascheroni constant
M_PHI
Value of [lower-case 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

- Relationships

-  Notes
(0005430)
andras_farkas (reporter)
2021-08-07 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)
2021-08-07 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 XSI-marked:
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 [lower-case gamma], Euler-Mascheroni constant
M_PHI
Value of [lower-case phi], ( (1 + sqrt(5))/2 ), golden ratio constant
(0005541)
geoffclare (manager)
2021-12-02 17:24
edited on: 2021-12-02 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, L9745-9746 and extend the shading down to L9759 (as a single shading block).

(0005598)
geoffclare (manager)
2022-01-13 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
2021-08-07 20:59 andras_farkas New Issue
2021-08-07 20:59 andras_farkas Name => Andras Farkas
2021-08-07 20:59 andras_farkas Section => math.h
2021-08-07 21:32 andras_farkas Note Added: 0005430
2021-08-07 21:41 andras_farkas Note Added: 0005431
2021-12-02 17:24 geoffclare Note Added: 0005541
2021-12-02 17:25 geoffclare Final Accepted Text => Note: 0005541
2021-12-02 17:25 geoffclare Status New => Resolved
2021-12-02 17:25 geoffclare Resolution Open => Accepted As Marked
2021-12-02 17:25 geoffclare Tag Attached: issue8
2021-12-02 17:39 geoffclare Note Edited: 0005541
2022-01-13 10:13 geoffclare Note Added: 0005598
2022-01-13 10:13 geoffclare Status Resolved => Applied


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker