GCC Quad-Precision Math Library Manual: Errors

FX Coudert fxcoudert@gmail.com
Mon Aug 19 21:26:42 GMT 2024


Hi Peter,

You are right, thanks for reporting these issues in the libquadmath documentation. I am CC’ing the GCC mailing-list. Does the following patch seem right?

diff --git a/libquadmath/libquadmath.texi b/libquadmath/libquadmath.texi
index dc2a9ff374b..ce4accf6421 100644
--- a/libquadmath/libquadmath.texi
+++ b/libquadmath/libquadmath.texi
@@ -118,15 +118,15 @@ The following mathematical constants of type @code{__float128} are defined.
   @table @asis
 @item @code{M_Eq}: the constant e (Euler's number)
-@item @code{M_LOG2Eq}: binary logarithm of 2
-@item @code{M_LOG10Eq}: common, decimal logarithm of 2
+@item @code{M_LOG2Eq}: base 2 logarithm of e
+@item @code{M_LOG10Eq}: decimal (base 10) logarithm of e
 @item @code{M_LN2q}: natural logarithm of 2
 @item @code{M_LN10q}: natural logarithm of 10
 @item @code{M_PIq}: pi
 @item @code{M_PI_2q}: pi divided by two
 @item @code{M_PI_4q}: pi divided by four
 @item @code{M_1_PIq}: one over pi
-@item @code{M_2_PIq}: one over two pi
+@item @code{M_2_PIq}: two over pi
 @item @code{M_2_SQRTPIq}: two over square root of pi
 @item @code{M_SQRT2q}: square root of 2
 @item @code{M_SQRT1_2q}: one over square root of 2


Regarding the naming of M_SQRT1_2q, it simply follows the traditional M_SQRT1_2 macro which, according to glibc doc: "These constants come from the Unix98 standard and were also available in 4.4BSD”. I agree with you that logic would dictate M_1_SQRT2, but we simply follow the existing pattern there.

Best,
FX


> Many thanks for the 'quadmath.h' library, which is where I found this email address.  I have addressed this email to you as the problem isn't a bug in GCC itself, it didn't seem right to try and coerce it into the bug report system, and I didn't know where else to start, but I appreciate that the problem is not yours, especially as the corresponding comments in  'quadmath.h' itself are correct.  I'd be grateful if you could forward it to whoever is maintaining the Quad-Precision Math Library Manuals. 
> 
> Three of the constants are mis-labelled in the current (14.2) version of that Library Manual document (and in all the previous versions I've looked at) , as follows:
> 
> M_LOG2Eq:  )  both are described as logarithms of 2, whereas they are logarithms of 'e'
> M_LOG10Eq: )
> ...
> M_2_PIq:    described as "one over two pi", actually two over pi [2/pi]
> 
> Additionally, whilst I realise that the two are mathematically equal, the generic 'M_numerator_denominatorq' naming format convention suggests that M_SQRT1_2q, described as "one over square root of 2", should better be labelled as "square root of (1/2)"; M_1_SQRT2q would be the name that corresponds to the original description.  Is this a lacuna in the standard?
> 
> Regards
> 
> Peter Randall




More information about the Gcc mailing list