All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: "Alejandro Colomar (man-pages)" <alx.manpages@gmail.com>
Cc: mtk.manpages@gmail.com, xenoantares@gmx.net,
	linux-man@vger.kernel.org, Jakub Wilk <jwilk@jwilk.net>,
	Walter Harms <wharms@bfs.de>
Subject: Re: expm1(3p): Mathematical error in given example
Date: Sun, 14 Feb 2021 18:27:45 +0100	[thread overview]
Message-ID: <8d9d97a4-3c74-084a-f611-93eb3a7192c0@gmail.com> (raw)
In-Reply-To: <258ea05f-e750-bcf0-9c76-7b4c04bef48a@gmail.com>

Hi Alex,

On 2/14/21 1:23 PM, Alejandro Colomar (man-pages) wrote:
> Hi Michael,
> 
> On 2/14/21 12:34 PM, Michael Kerrisk (man-pages) wrote:
>> On 2/12/21 10:41 AM, Jakub Wilk wrote:
>>> * Alejandro Colomar <alx.manpages@gmail.com>, 2021-02-11, 16:49:
>>>>> 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.
>>> [...]
>>>> 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.
> 
> 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.

>> 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

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

      reply	other threads:[~2021-02-14 17:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11  9:59 expm1(3p): Mathematical error in given example xenoantares
2021-02-11 10:54 ` AW: " Walter Harms
2021-02-11 15:49 ` Alejandro Colomar (man-pages)
2021-02-12  9:41   ` Jakub Wilk
2021-02-14 11:34     ` Michael Kerrisk (man-pages)
2021-02-14 12:23       ` Alejandro Colomar (man-pages)
2021-02-14 17:27         ` Michael Kerrisk (man-pages) [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8d9d97a4-3c74-084a-f611-93eb3a7192c0@gmail.com \
    --to=mtk.manpages@gmail.com \
    --cc=alx.manpages@gmail.com \
    --cc=jwilk@jwilk.net \
    --cc=linux-man@vger.kernel.org \
    --cc=wharms@bfs.de \
    --cc=xenoantares@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.