expm1(3p): Mathematical error in given example
Hi there!
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x
======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x
(with a fictional ** as power infix-operator) would be.
Best regards
-- XA
____
[1] As of version to be found at
https://man7.org/linux/man-pages/man3/expm1.3p.html
--
XenoAntares
yes, this is wrong on the webpage but issems a converter bug. when i look at the page in ascii i see: ((1+x)**n-1)/x.
the same problem arises on other place like:
These functions shall compute ex-1.0.
should read: e**x-1.0
NTL: thx for info
wh
________________________________________
Von: [email protected] <[email protected]>
Gesendet: Donnerstag, 11. Februar 2021 10:59:18
An: [email protected]; [email protected]
Cc: [email protected]
Betreff: expm1(3p): Mathematical error in given example
Hi there!
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x
======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x
(with a fictional ** as power infix-operator) would be.
Best regards
-- XA
____
[1] As of version to be found at
https://man7.org/linux/man-pages/man3/expm1.3p.html
--
XenoAntares
Hi XA,
Quoted 19 lines · On 2/11/21 10:59 AM, [email protected] wrote:
Hi there!
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x(with a fictional ** as power infix-operator) would be.
Quoted 9 lines
Best regards
-- XA____
[1] As of version to be found athttps://man7.org/linux/man-pages/man3/expm1.3p.html--
XenoAntares
We don't maintain the source of the POSIX manual pages. You could file a bug to the Austin Group. I checked that in expm1(3) that doesn't happen.
Thanks,
Alex
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
* Alejandro Colomar <[email protected]>, 2021-02-11, 16:49:
Quoted 15 lines
Quoted 15 lines
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x(with a fictional ** as power infix-operator) would be.
[...]
Quoted 1 line
We don't maintain the source of the POSIX manual pages. You could file a bug to the Austin Group.
As Walter noted in another mail, the POSIX sources are correct.
This is a problem with conversion to the man page format, which should be reported here, not to the Austin Group.
Signature · 1 line
Jakub Wilk
Quoted 16 lines · Jakub Wilk
* Alejandro Colomar <[email protected]>, 2021-02-11, 16:49:
Quoted 8 lines
Quoted 8 lines
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/xQuoted 7 lines
Quoted 7 lines
======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x(with a fictional ** as power infix-operator) would be.
Quoted 8 lines
[...]
Quoted 2 lines
We don't maintain the source of the POSIX manual pages. You could file a bug to the Austin Group.
As Walter noted in another mail, the POSIX sources are correct.
This is a problem with conversion to the man page format, which should be reported here, not to the Austin Group.
Indeed, it is a problem in the conversion. Or, more precisely, the POSIX manual pages are using \u...\d to achieve superscripting for exponentiation, which of course does not render meaningfully on a terminal. The issue affects 19 pages that I found. I plan to apply the patch below, which uses the fictional '**' operator to indicate power-of. Seem okay?
Thanks,
Michael
man-pages-posix-2017/man0p/complex.h.0p +1 -1
@@ -31,7 +31,7 @@ Expands to a constant expression of type .BR "const float _Complex" , with the value of the imaginary unit (that is, a number .IR i -such that \fIi\fR\s-3\u2\d\s+3=\-1). +such that \fIi\fR**2=\-1). .IP imaginary 12 Expands to .BR _Imaginary .
man-pages-posix-2017/man0p/stdint.h.0p +3 -3
@@ -38,11 +38,11 @@ its value in a pure binary system; the actual type may use more bits than that (for example, a 28-bit type could be stored in 32 bits of actual storage). An .IR N -bit -signed type has values in the range \-2\s-3\u\fIN\fR\-1\d\s+3 or -1\-2\s-3\u\fIN\fR\-1\d\s+3 to 2\s-3\u\fIN\fR\-1\d\s+3\-1, while +signed type has values in the range \-2**(\fIN\fR\-1) or +1\-2**(\fIN\fR\-1) to 2**(\fIN\fR\-1)\-1, while an .IR N -bit -unsigned type has values in the range 0 to 2\s-3\u\fIN\fR\d\s+3\-1. +unsigned type has values in the range 0 to 2**\fIN\fR\-1. .P .P Types are defined in the following categories:
man-pages-posix-2017/man0p/sys_socket.h.0p +1 -1
@@ -443,7 +443,7 @@ may also make visible all symbols from .IR "The following sections are informative." .SH "APPLICATION USAGE" To forestall portability problems, it is recommended that applications -not use values larger than 2\u\s-331\s+3\d \-1 for the +not use values larger than 2**31 \-1 for the .BR socklen_t type. .P
man-pages-posix-2017/man1p/bc.1p +1 -1
@@ -650,7 +650,7 @@ if is less than 10. For .BR obase values other than 10, this should be the number of digits needed to -represent a precision of 10\u\s-3\fIs\fP\s+3\d. +represent a precision of 10**\fIs\fP. .P For .BR obase
man-pages-posix-2017/man1p/cksum.1p +3 -2
@@ -29,7 +29,8 @@ polynomial: .RS 4 .nf -\fIG\fR(\fIx\fR)=\fIx\fR\u\s-332\s+3\d+\fIx\fR\u\s-326\s+3\d+\fIx\fR\u\s-323\s+3\d+\fIx\fR\u\s-322\s+3\d+\fIx\fR\u\s-316\s+3\d+\fIx\fR\u\s-312\s+3\d+\fIx\fR\u\s-311\s+3\d+\fIx\fR\u\s-310\s+3\d+\fIx\fR\u\s-38\s+3\d+\fIx\fR\u\s-37\s+3\d+\fIx\fR\u\s-35\s+3\d+\fIx\fR\u\s-34\s+3\d+\fIx\fR\u\s-32\s+3\d+\fIx\fR+1 +\fIG\fR(\fIx\fR)=\fIx\fR**32+\fIx\fR**26+\fIx\fR**23+\fIx\fR**22+\fIx\fR**16+\fIx\fR**12+\fIx\fR**11+ + \fIx\fR**10+\fIx\fR**8+\fIx\fR**7+\fIx\fR**5+\fIx\fR**4+\fIx\fR**2+\fIx\fR+1 .fi .P .RE
@@ -58,7 +59,7 @@ capable of representing this integer shall be used. .IR M (\c .IR x ) is multiplied by -.IR x \u\s-332\s+3\d +.IR x **32 (that is, shifted left 32 bits) and divided by .IR G (\c .IR x )
man-pages-posix-2017/man1p/pax.1p +1 -1
@@ -3191,7 +3191,7 @@ block value of 10\|240 bytes for .IR tar was selected because that is the standard block-size value for BSD .IR tar . -The maximum block size of 32\|256 bytes (2\s-3\u15\d\s+3\-512 bytes) +The maximum block size of 32\|256 bytes (2**15\-512 bytes) is the largest multiple of 512 bytes that fits into a signed 16-bit tape controller transfer register. There are known limitations in some historical systems that would prevent larger blocks from being
man-pages-posix-2017/man3p/cexp.3p +1 -1
@@ -28,7 +28,7 @@ ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the I .P These functions shall compute the complex exponent of .IR z , -defined as \fIe\s-3\uz\d\s+3\fR. +defined as \fIe**z\fR. .SH "RETURN VALUE" These functions shall return the complex exponential value of .IR z .
man-pages-posix-2017/man3p/cpow.3p +1 -1
@@ -28,7 +28,7 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the complex power function -\fIx\s-3\uy\d\s+3\fR, with a branch cut for the first parameter along +\fIx**y\fR, with a branch cut for the first parameter along the negative real axis. .SH "RETURN VALUE" These functions shall return the complex power function value.
man-pages-posix-2017/man3p/drand48.3p +2 -2
@@ -52,14 +52,14 @@ The and \fInrand48\fR() functions shall return non-negative, long integers, uniformly -distributed over the interval [0,2\u\s-331\s+3\d). +distributed over the interval [0,2**31). .P The \fImrand48\fR() and \fIjrand48\fR() functions shall return signed long integers uniformly distributed over -the interval [\-2\u\s-331\s+3\d,2\u\s-331\s+3\d). +the interval [\-2**31,2**31). .P The \fIsrand48\fR(),
man-pages-posix-2017/man3p/exp2.3p +1 -1
@@ -39,7 +39,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions shall return -2\fI\s-3\ux\d\s+3\fR. +2\fI**x\fR. .P If the correct value would cause overflow, a range error shall occur and
man-pages-posix-2017/man3p/expm1.3p +3 -3
@@ -26,7 +26,7 @@ The functionality described on this reference page is aligned with the ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P -These functions shall compute \fIe\u\s-3x\s+3\d\fR\-1.0. +These functions shall compute \fIe**x\fR\-1.0. .P An application wishing to check for error situations should set .IR errno
@@ -38,7 +38,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions return -\fIe\s-3\ux\d\s+3\fR\-1.0. +\fIe**x\fR\-1.0. .P If the correct value would cause overflow, a range error shall occur and
@@ -131,7 +131,7 @@ The and \fIlog1p\fR() functions are useful for financial calculations of -((1+\fIx\fR)\u\s-3\fIn\fR\s+3\d\-1)/\fIx\fR, namely: +((1+\fIx\fR)**\fIn\fR\-1)/\fIx\fR, namely: .sp .RS 4 .nf
man-pages-posix-2017/man3p/hypot.3p +2 -2
@@ -27,8 +27,8 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the value of the square root of -.IR x \s-3\u2\d\s+3+\c -.IR y \s-3\u2\d\s+3 +.IR x **2+\c +.IR y **2 without undue overflow or underflow. .P An application wishing to check for error situations should set
man-pages-posix-2017/man3p/initstate.3p +3 -3
@@ -30,13 +30,13 @@ function shall use a non-linear additive feedback random-number generator employing a default state array size of 31 .BR long integers to return successive pseudo-random numbers in the range from 0 -to 2\u\s-331\s+3\d\-1. The period of this random-number generator is -approximately 16 x (2\s-3\u31\d\s+3\-\fR1). The size of the state +to 2**31\-1. The period of this random-number generator is +approximately 16 x (2**31\-\fR1). The size of the state array determines the period of the random-number generator. Increasing the state array size shall increase the period. .P With 256 bytes of state information, the period of the random-number -generator shall be greater than 2\s-3\u69\d\s+3. +generator shall be greater than 2**69. .P Like \fIrand\fR(),
man-pages-posix-2017/man3p/ldexp.3p +1 -1
@@ -27,7 +27,7 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the quantity -\fIx\fR\ *\ 2\u\s-3\fIexp\fR\s+3\d. +\fIx\fR\ *\ 2**\fIexp\fR. .P An application wishing to check for error situations should set .IR errno
man-pages-posix-2017/man3p/logb.3p +1 -1
@@ -47,7 +47,7 @@ finite positive .RS 4 .nf -1 <= \fIx\fP * FLT_RADIX\s-3\u-logb(x)\d\s+3 < FLT_RADIX +1 <= \fIx\fP * FLT_RADIX**(-logb(x)) < FLT_RADIX .fi .P .RE
man-pages-posix-2017/man3p/pow.3p +1 -1
@@ -30,7 +30,7 @@ These functions shall compute the value of .IR x raised to the power .IR y , -.IR x\u\s-3y\s+3\d . +.IR x**y . If .IR x is negative, the application shall ensure that
man-pages-posix-2017/man3p/rand.3p +1 -1
@@ -35,7 +35,7 @@ The function shall compute a sequence of pseudo-random integers in the range [0,\c {RAND_MAX}] -with a period of at least 2\u\s-332\s0\d. +with a period of at least 2**32 .P The \fIrand\fR()
man-pages-posix-2017/man3p/remquo.3p +1 -1
@@ -41,7 +41,7 @@ functions, respectively. In the object pointed to by they store a value whose sign is the sign of .IR x /\c .IR y -and whose magnitude is congruent modulo 2\fI\s-3\un\d\s+3\fR to the +and whose magnitude is congruent modulo 2\fI**n\fR to the magnitude of the integral quotient of .IR x /\c .IR y ,
man-pages-posix-2017/man3p/scalbln.3p +3 -3
@@ -32,8 +32,8 @@ The functionality described on this reference page is aligned with the ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P -These functions shall compute \fIx\fR\ *\ FLT_RADIX\fI\s-3\un\d\s+3\fR -efficiently, not normally by computing FLT_RADIX\fI\s-3\un\d\s+3\fR +These functions shall compute \fIx\fR\ *\ FLT_RADIX**\fIn\fR +efficiently, not normally by computing FLT_RADIX**\fIn\fR explicitly. .P An application wishing to check for error situations should set
@@ -46,7 +46,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions shall return -\fIx\fR\ *\ FLT_RADIX\fI\s-3\un\d\s+3\fR. +\fIx\fR\ *\ FLT_RADIX**\fIn\fR. .P If the result would cause overflow, a range error shall occur and these functions shall return \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/
Hi Michael,
Quoted 23 lines · Michael Kerrisk (man-pages)
Quoted 22 lines · Jakub Wilk
* Alejandro Colomar <[email protected]>, 2021-02-11, 16:49:
Quoted 15 lines
Quoted 15 lines
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x(with a fictional ** as power infix-operator) would be.
[...]
Quoted 2 lines
We don't maintain the source of the POSIX manual pages. You could file a bug to the Austin Group.
As Walter noted in another mail, the POSIX sources are correct.
Quoted 7 lines
Quoted 2 lines
This is a problem with conversion to the man page format, which should be reported here, not to the Austin Group.
Indeed, it is a problem in the conversion. Or, more precisely, the POSIX manual pages are using \u...\d to achieve superscripting for exponentiation, which of course does not render meaningfully on a terminal.
I guess this is caused by posix.py, right? If so, would you mind patching that so that future POSIX revisions are also fixed? I don't understand that file so much...
Quoted 3 lines
The issue affects 19 pages that I found. I plan
to apply the patch below, which uses the fictional '**' operator to indicate power-of. Seem okay?
I didn't read all of them, but from the first few, looks good to me.
Thanks,
Alex
Quoted 318 lines
Thanks,
Michael
man-pages-posix-2017/man0p/complex.h.0p +1
-1@@ -31,7 +31,7 @@ Expands to a constant expression of type .BR "const float _Complex" , with the value of the imaginary unit (that is, a number .IR i -such that \fIi\fR\s-3\u2\d\s+3=\-1). +such that \fIi\fR**2=\-1). .IP imaginary 12 Expands to .BR _Imaginary .man-pages-posix-2017/man0p/stdint.h.0p +3
-3@@ -38,11 +38,11 @@ its value in a pure binary system; the actual type may use more bits than that (for example, a 28-bit type could be stored in 32 bits of actual storage). An .IR N -bit -signed type has values in the range \-2\s-3\u\fIN\fR\-1\d\s+3 or -1\-2\s-3\u\fIN\fR\-1\d\s+3 to 2\s-3\u\fIN\fR\-1\d\s+3\-1, while +signed type has values in the range \-2**(\fIN\fR\-1) or +1\-2**(\fIN\fR\-1) to 2**(\fIN\fR\-1)\-1, while an .IR N -bit -unsigned type has values in the range 0 to 2\s-3\u\fIN\fR\d\s+3\-1. +unsigned type has values in the range 0 to 2**\fIN\fR\-1. .P .P Types are defined in the following categories:man-pages-posix-2017/man0p/sys_socket.h.0p +1
-1@@ -443,7 +443,7 @@ may also make visible all symbols from .IR "The following sections are informative." .SH "APPLICATION USAGE" To forestall portability problems, it is recommended that applications -not use values larger than 2\u\s-331\s+3\d \-1 for the +not use values larger than 2**31 \-1 for the .BR socklen_t type. .Pman-pages-posix-2017/man1p/bc.1p +1
-1@@ -650,7 +650,7 @@ if is less than 10. For .BR obase values other than 10, this should be the number of digits needed to -represent a precision of 10\u\s-3\fIs\fP\s+3\d. +represent a precision of 10**\fIs\fP. .P For .BR obaseman-pages-posix-2017/man1p/cksum.1p +3
-2@@ -29,7 +29,8 @@ polynomial: .RS 4 .nf -\fIG\fR(\fIx\fR)=\fIx\fR\u\s-332\s+3\d+\fIx\fR\u\s-326\s+3\d+\fIx\fR\u\s-323\s+3\d+\fIx\fR\u\s-322\s+3\d+\fIx\fR\u\s-316\s+3\d+\fIx\fR\u\s-312\s+3\d+\fIx\fR\u\s-311\s+3\d+\fIx\fR\u\s-310\s+3\d+\fIx\fR\u\s-38\s+3\d+\fIx\fR\u\s-37\s+3\d+\fIx\fR\u\s-35\s+3\d+\fIx\fR\u\s-34\s+3\d+\fIx\fR\u\s-32\s+3\d+\fIx\fR+1 +\fIG\fR(\fIx\fR)=\fIx\fR**32+\fIx\fR**26+\fIx\fR**23+\fIx\fR**22+\fIx\fR**16+\fIx\fR**12+\fIx\fR**11+ + \fIx\fR**10+\fIx\fR**8+\fIx\fR**7+\fIx\fR**5+\fIx\fR**4+\fIx\fR**2+\fIx\fR+1 .fi .P .RE@@ -58,7 +59,7 @@ capable of representing this integer shall be used. .IR M (\c .IR x ) is multiplied by -.IR x \u\s-332\s+3\d +.IR x **32 (that is, shifted left 32 bits) and divided by .IR G (\c .IR x )man-pages-posix-2017/man1p/pax.1p +1
-1@@ -3191,7 +3191,7 @@ block value of 10\|240 bytes for .IR tar was selected because that is the standard block-size value for BSD .IR tar . -The maximum block size of 32\|256 bytes (2\s-3\u15\d\s+3\-512 bytes) +The maximum block size of 32\|256 bytes (2**15\-512 bytes) is the largest multiple of 512 bytes that fits into a signed 16-bit tape controller transfer register. There are known limitations in some historical systems that would prevent larger blocks from beingman-pages-posix-2017/man3p/cexp.3p +1
-1@@ -28,7 +28,7 @@ ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the I .P These functions shall compute the complex exponent of .IR z , -defined as \fIe\s-3\uz\d\s+3\fR. +defined as \fIe**z\fR. .SH "RETURN VALUE" These functions shall return the complex exponential value of .IR z .man-pages-posix-2017/man3p/cpow.3p +1
-1@@ -28,7 +28,7 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the complex power function -\fIx\s-3\uy\d\s+3\fR, with a branch cut for the first parameter along +\fIx**y\fR, with a branch cut for the first parameter along the negative real axis. .SH "RETURN VALUE" These functions shall return the complex power function value.man-pages-posix-2017/man3p/drand48.3p +2
-2@@ -52,14 +52,14 @@ The and \fInrand48\fR() functions shall return non-negative, long integers, uniformly -distributed over the interval [0,2\u\s-331\s+3\d). +distributed over the interval [0,2**31). .P The \fImrand48\fR() and \fIjrand48\fR() functions shall return signed long integers uniformly distributed over -the interval [\-2\u\s-331\s+3\d,2\u\s-331\s+3\d). +the interval [\-2**31,2**31). .P The \fIsrand48\fR(),man-pages-posix-2017/man3p/exp2.3p +1
-1@@ -39,7 +39,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions shall return -2\fI\s-3\ux\d\s+3\fR. +2\fI**x\fR. .P If the correct value would cause overflow, a range error shall occur andman-pages-posix-2017/man3p/expm1.3p +3
-3@@ -26,7 +26,7 @@ The functionality described on this reference page is aligned with the ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P -These functions shall compute \fIe\u\s-3x\s+3\d\fR\-1.0. +These functions shall compute \fIe**x\fR\-1.0. .P An application wishing to check for error situations should set .IR errno@@ -38,7 +38,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions return -\fIe\s-3\ux\d\s+3\fR\-1.0. +\fIe**x\fR\-1.0. .P If the correct value would cause overflow, a range error shall occur and@@ -131,7 +131,7 @@ The and \fIlog1p\fR() functions are useful for financial calculations of -((1+\fIx\fR)\u\s-3\fIn\fR\s+3\d\-1)/\fIx\fR, namely: +((1+\fIx\fR)**\fIn\fR\-1)/\fIx\fR, namely: .sp .RS 4 .nfman-pages-posix-2017/man3p/hypot.3p +2
-2@@ -27,8 +27,8 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the value of the square root of -.IR x \s-3\u2\d\s+3+\c -.IR y \s-3\u2\d\s+3 +.IR x **2+\c +.IR y **2 without undue overflow or underflow. .P An application wishing to check for error situations should setman-pages-posix-2017/man3p/initstate.3p +3
-3@@ -30,13 +30,13 @@ function shall use a non-linear additive feedback random-number generator employing a default state array size of 31 .BR long integers to return successive pseudo-random numbers in the range from 0 -to 2\u\s-331\s+3\d\-1. The period of this random-number generator is -approximately 16 x (2\s-3\u31\d\s+3\-\fR1). The size of the state +to 2**31\-1. The period of this random-number generator is +approximately 16 x (2**31\-\fR1). The size of the state array determines the period of the random-number generator. Increasing the state array size shall increase the period. .P With 256 bytes of state information, the period of the random-number -generator shall be greater than 2\s-3\u69\d\s+3. +generator shall be greater than 2**69. .P Like \fIrand\fR(),man-pages-posix-2017/man3p/ldexp.3p +1
-1@@ -27,7 +27,7 @@ ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P These functions shall compute the quantity -\fIx\fR\ *\ 2\u\s-3\fIexp\fR\s+3\d. +\fIx\fR\ *\ 2**\fIexp\fR. .P An application wishing to check for error situations should set .IR errnoman-pages-posix-2017/man3p/logb.3p +1
-1@@ -47,7 +47,7 @@ finite positive .RS 4 .nf -1 <= \fIx\fP * FLT_RADIX\s-3\u-logb(x)\d\s+3 < FLT_RADIX +1 <= \fIx\fP * FLT_RADIX**(-logb(x)) < FLT_RADIX .fi .P .REman-pages-posix-2017/man3p/pow.3p +1
-1@@ -30,7 +30,7 @@ These functions shall compute the value of .IR x raised to the power .IR y , -.IR x\u\s-3y\s+3\d . +.IR x**y . If .IR x is negative, the application shall ensure thatman-pages-posix-2017/man3p/rand.3p +1
-1@@ -35,7 +35,7 @@ The function shall compute a sequence of pseudo-random integers in the range [0,\c {RAND_MAX}] -with a period of at least 2\u\s-332\s0\d. +with a period of at least 2**32 .P The \fIrand\fR()man-pages-posix-2017/man3p/remquo.3p +1
-1@@ -41,7 +41,7 @@ functions, respectively. In the object pointed to by they store a value whose sign is the sign of .IR x /\c .IR y -and whose magnitude is congruent modulo 2\fI\s-3\un\d\s+3\fR to the +and whose magnitude is congruent modulo 2\fI**n\fR to the magnitude of the integral quotient of .IR x /\c .IR y ,man-pages-posix-2017/man3p/scalbln.3p +3
-3@@ -32,8 +32,8 @@ The functionality described on this reference page is aligned with the ISO\ C standard. Any conflict between the requirements described here and the ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard. .P -These functions shall compute \fIx\fR\ *\ FLT_RADIX\fI\s-3\un\d\s+3\fR -efficiently, not normally by computing FLT_RADIX\fI\s-3\un\d\s+3\fR +These functions shall compute \fIx\fR\ *\ FLT_RADIX**\fIn\fR +efficiently, not normally by computing FLT_RADIX**\fIn\fR explicitly. .P An application wishing to check for error situations should set@@ -46,7 +46,7 @@ is non-zero or \fIfetestexcept\fR(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero, an error has occurred. .SH "RETURN VALUE" Upon successful completion, these functions shall return -\fIx\fR\ *\ FLT_RADIX\fI\s-3\un\d\s+3\fR. +\fIx\fR\ *\ FLT_RADIX**\fIn\fR. .P If the result would cause overflow, a range error shall occur and these functions shall return \(+-HUGE_VAL, \(+-HUGE_VALF, and \(+-HUGE_VALL
Signature · 3 lines
Alejandro Colomar Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/ http://www.alejandro-colomar.es/
Hi Alex,
Quoted 29 lines · Alejandro Colomar (man-pages)
Hi Michael,
Quoted 26 lines · Michael Kerrisk (man-pages)
Quoted 24 lines · Jakub Wilk
* Alejandro Colomar <[email protected]>, 2021-02-11, 16:49:
Quoted 15 lines
Quoted 15 lines
In the APPLICATION USAGE section of expm1(3p)[1] the given example is wrong:
===8<=== Snip =========================================
[..] calculations of ((1+x)n-1)/x, namely:
expm1(n * log1p(x))/x======== Snap ====================================>8===
Actually, both expressions are not equal, rather
expm1(n * log1p(x))/x = ((1+x)**n - 1)/x(with a fictional ** as power infix-operator) would be.
[...]
Quoted 2 lines
We don't maintain the source of the POSIX manual pages. You could file a bug to the Austin Group.
As Walter noted in another mail, the POSIX sources are correct.
This is a problem with conversion to the man page format, which should be reported here, not to the Austin Group.
Quoted 8 lines
Quoted 4 lines
Indeed, it is a problem in the conversion. Or, more precisely, the POSIX manual pages are using \u...\d to achieve superscripting for exponentiation, which of course does not render meaningfully on a terminal.
I guess this is caused by
posix.py, right? If so, would you mind patching that so that future POSIX revisions are also fixed? I don't understand that file so much...
Unfortunately, it's not quite so simple. There was at least one case (od.1p) where this fix was not correct (i.e., superscripting was not being used to mean power-of). Plus there was at least one case where a long line needed to be manually wrapped (cksum.1p). Plus, sometimes the \u..\d was used in conjunction
with font-size change markup (\s-N...\s+N) that was variously inside or outside the \u...\d. Plus, sometimes parentheses needed to be added around the superscript value. All of it is probably solvable with some (slightly complicated) scripting, but for now the manual edit just seemed much faster.
Quoted 5 lines
Quoted 3 lines
The issue affects 19 pages that I found. I plan
to apply the patch below, which uses the fictional '**' operator to indicate power-of. Seem okay?I didn't read all of them, but from the first few, looks good to me.
Thanks for taking a look.
Cheers,
Michael
Signature · 3 lines
Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/