Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Are you having fun yet?


devel / comp.lang.python / Re: Precision Tail-off?

SubjectAuthor
* Re: Precision Tail-off?Oscar Benjamin
`* Re: Precision Tail-off?Peter Pearson
 +* Re: Precision Tail-off?Stephen Tucker
 |`- Re: Precision Tail-off?Peter Pearson
 +- Re: Precision Tail-off?Stephen Tucker
 +- Re: Precision Tail-off?Thomas Passin
 +- Re: Precision Tail-off?Weatherby,Gerard
 +- RE: Precision Tail-off?<avi.e.gross
 +- Re: Precision Tail-off?Michael Torrie
 +* Re: Precision Tail-off?Richard Damon
 |`* Re: Precision Tail-off?Greg Ewing
 | +* Re: Precision Tail-off?Chris Angelico
 | |`- Re: Precision Tail-off?Paul Rubin
 | +- Re: Precision Tail-off?Oscar Benjamin
 | `- Re: Precision Tail-off?Peter J. Holzer
 +- Re: Precision Tail-off?Oscar Benjamin
 +- Re: Precision Tail-off?Peter J. Holzer
 +- Re: Precision Tail-off?Peter J. Holzer
 +- Re: Precision Tail-off?Peter J. Holzer
 +- Re: Precision Tail-off?Grant Edwards
 +- Re: Precision Tail-off?Mats Wichmann
 +- Re: Precision Tail-off?Grant Edwards
 +- Re: Precision Tail-off?Michael Torrie
 `- Re: Precision Tail-off?Oscar Benjamin

1
Re: Precision Tail-off?

<mailman.1817.1676373454.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21682&group=comp.lang.python#21682

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: oscar.j....@gmail.com (Oscar Benjamin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Tue, 14 Feb 2023 11:17:20 +0000
Lines: 77
Message-ID: <mailman.1817.1676373454.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de k9oDiRkUyqWSQVNAkvFGjw2nv8e42PlUqH/T8xd/gnGg==
Return-Path: <oscar.j.benjamin@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=BmLj8YHy;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.019
X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; '2023': 0.07;
'explanation': 0.07; 'expansion': 0.09; 'expression': 0.09;
'float': 0.09; 'idle': 0.09; 'likewise': 0.09; 'questions:': 0.09;
'supplied': 0.09; 'log': 0.12; 'import': 0.15; '(1.0': 0.16;
'base.': 0.16; 'behaviour': 0.16; 'bits': 0.16; 'calculation':
0.16; 'comparing': 0.16; 'decimal': 0.16; 'linearly': 0.16;
'received:209.85.167.53': 0.16; 'received:mail-
lf1-f53.google.com': 0.16; 'wrote:': 0.16; 'python': 0.16;
'larger': 0.17; 'feb': 0.17; 'tue,': 0.19; 'to:addr:python-list':
0.20; 'cannot': 0.25; 'bit': 0.27; '>>>': 0.28; 'expect': 0.28;
'output': 0.28; 'series': 0.28; 'error': 0.29; 'effect': 0.31;
'question': 0.32; 'message-id:@mail.gmail.com': 0.32; 'there':
0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'following': 0.35;
'from:addr:gmail.com': 0.35; 'really': 0.37; 'using': 0.37;
'received:209.85': 0.37; 'means': 0.38; 'received:209': 0.39;
'two': 0.39; 'quite': 0.39; 'adding': 0.39; 'use': 0.39;
'neither': 0.39; 'appears': 0.40; 'base': 0.40; 'exact': 0.40;
'match': 0.40; 'should': 0.40; 'here.': 0.61; 'here': 0.62;
'leading': 0.63; 'your': 0.64; 'less': 0.65; 'numbers': 0.67;
'exactly': 0.68; 'further': 0.69; 'and,': 0.69; 'compare': 0.69;
'figures': 0.69; 'showed': 0.69; 'skip:1 40': 0.69; 'accurate':
0.74; 'skip:4 10': 0.75; 'yes': 0.76; 'significant': 0.78;
'again:': 0.84; 'inputs': 0.84; 'oscar': 0.84; 'root:': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=1d3g3S4e7t/ib7Oa1AeGE9TQZnApL6ui4pfmn2ffci8=;
b=BmLj8YHyeoPXdNeo39BeAZ356WDe/trBOBVIYSqyp0QY2AWTDIG9KLi14ReNrE5BfW
TLAbofmv34yMuEhmlzH5LQSAm+SzZTunoB1y694DBuWzB1MRw3nw/6jJLrbmUISF5URJ
PUC6UJAU+w5MXs4oiumrJvOP3U7L0LfH6zSTWUQoVlgZ2MdkQASdA+5A1M2jzS3OM575
3CqKZXEYiEhsuIR0U03ZSlZUuwpMVJRKBN1jRsB7s5I4by7CCGssr0EyScdyVl4yU3I5
/84LWqR2vJdYolkLnQTDk+2Io5HRQPRLqHBDIvWM/kYODvUSgKb9DWxmgcfpjlXw/Yz9
EG0A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=1d3g3S4e7t/ib7Oa1AeGE9TQZnApL6ui4pfmn2ffci8=;
b=QkYoJAxJbGIo2wVXYVwa80FxmsJnMo8kaf4KML6/xbwrjeqatKH8geEaK0uZnLcvy3
8u+LDdUDyLlEq/UW3ZH+/fpU6bRz6LLfBwARyqVekJsx4lxDj8YYetxS2jXSdepnozWA
y1xleAlATRyd/o6efSRsXBBhhiTipxNnKQuZeOZ6RSRsL0MNE5gby3T41bPaJqQ1R8iL
tH3dOaEf5hdKuUkzzwy2qODKp19DPeTlhcpGDCiDEuwSU2c42M5dGaMuS4h34DK97YEb
GzEpNGQZ3EGxQw/QroQie4o8BrIjn5doX4EOv6mb6HJEJBcqqEbEtUV8esH3RTiKI8fW
502A==
X-Gm-Message-State: AO0yUKWi5DZCbgkqk/Mb8TUoPjTVF+wIRUo5P1H0vjUeCcY1vzyOzXPU
3MLMTufSY6rmWSG/CJk7n47l1wprHVIadFHmXOr7b8VEBSk=
X-Google-Smtp-Source: AK7set8Mt8yxMFdiQo0AxLv82gmrbeIoBStvkeBpvwZS8ZZTDJngQiwU/7IoGZLaspvQN3642VlL3TqeG+oxy6lVuFQ=
X-Received: by 2002:ac2:5093:0:b0:4d8:5308:f795 with SMTP id
f19-20020ac25093000000b004d85308f795mr125093lfm.10.1676373451815; Tue, 14 Feb
2023 03:17:31 -0800 (PST)
In-Reply-To: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
 by: Oscar Benjamin - Tue, 14 Feb 2023 11:17 UTC

On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org> wrote:
>
> Hi,
>
> I have just produced the following log in IDLE (admittedly, in Python
> 2.7.10 and, yes I know that it has been superseded).
>
> It appears to show a precision tail-off as the supplied float gets bigger.
>
> I have two questions:
> 1. Is there a straightforward explanation for this or is it a bug?
> 2. Is the same behaviour exhibited in Python 3.x?
>
> For your information, the first 20 significant figures of the cube root in
> question are:
> 49793385921817447440
>
> Stephen Tucker.
> ----------------------------------------------
> >>> 123.456789 ** (1.0 / 3.0)
> 4.979338592181744
> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
> 49793385921817.36

You need to be aware that 1.0/3.0 is a float that is not exactly equal
to 1/3 and likewise the other float cannot have as many accurate
digits as is suggested by the number of zeros shown. Therefore you
should compare what exactly it means for the numbers you really have
rather than comparing with an exact cube root of the number that you
intended. Here I will do this with SymPy and calculate many more
digits than are needed. First here is the exact cube root:

In [29]: from sympy import *

In [30]: n = 123456789000000000000000000000000000000000

In [31]: cbrt(n).evalf(50)
Out[31]: 49793385921817.447440261250171604380899353243631762

So that's 50 digits of the exact cube root of the exact number and the
first 20 match what you showed. However in your calculation you use
floats so the exact expression that you evaluate is:

In [32]: e = Pow(Rational(float(n)), Rational(1.0/3.0), evaluate=False)

In [33]: print(e)
123456788999999998830049821836693930508288**(6004799503160661/18014398509481984)

Neither base or exponent is really the number that you intended it to
be. The first 50 decimal digits of this number are:

In [34]: e.evalf(50)
Out[34]: 49793385921817.360106660998131166304296436896582873

All of the digits in the calculation you showed match with the first
digits given here. The output from the float calculation is correct
given what the inputs actually are and also the available precision
for 64 bit floats (53 bits or ~16 decimal digits).

The reason that the results get further from your expectations as the
base gets larger is because the exponent is always less than 1/3 and
the relative effect of that difference is magnified for larger bases.
You can see this in a series expansion of a^x around x=1/3. Using
SymPy again:

In [37]: a, x = symbols('a, x')

In [38]: print(series(a**x, x, Rational(1, 3), 2))
a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))

You can see that the leading relative error term from x being not
quite equal to 1/3 is proportional to the log of the base. You should
expect this difference to grow approximately linearly as you keep
adding more zeros in the base.

--
Oscar

Re: Precision Tail-off?

<k57132F3e1U1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21712&group=comp.lang.python#21712

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: pkpear...@nowhere.invalid (Peter Pearson)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: 16 Feb 2023 15:40:19 GMT
Lines: 40
Message-ID: <k57132F3e1U1@mid.individual.net>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
X-Trace: individual.net XuUDlJCfKFK1AfBbL6I5Pgpk9wA4Ss4nu1Sn78qVhXZXDaEwQo
Cancel-Lock: sha1:S6bx+V7mA5Zm01e9KrM0pU1CtGc=
User-Agent: slrn/1.0.3 (Linux)
 by: Peter Pearson - Thu, 16 Feb 2023 15:40 UTC

On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
> On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org> wrote:
[snip]
>> I have just produced the following log in IDLE (admittedly, in Python
>> 2.7.10 and, yes I know that it has been superseded).
>>
>> It appears to show a precision tail-off as the supplied float gets bigger.
[snip]
>>
>> For your information, the first 20 significant figures of the cube root in
>> question are:
>> 49793385921817447440
>>
>> Stephen Tucker.
>> ----------------------------------------------
>> >>> 123.456789 ** (1.0 / 3.0)
>> 4.979338592181744
>> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
>> 49793385921817.36
>
> You need to be aware that 1.0/3.0 is a float that is not exactly equal
> to 1/3 ...
[snip]
> SymPy again:
>
> In [37]: a, x = symbols('a, x')
>
> In [38]: print(series(a**x, x, Rational(1, 3), 2))
> a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
>
> You can see that the leading relative error term from x being not
> quite equal to 1/3 is proportional to the log of the base. You should
> expect this difference to grow approximately linearly as you keep
> adding more zeros in the base.

Marvelous. Thank you.

--
To email me, substitute nowhere->runbox, invalid->com.

Re: Precision Tail-off?

<mailman.1845.1676629651.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21718&group=comp.lang.python#21718

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: stephen_...@sil.org (Stephen Tucker)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 10:27:08 +0000
Lines: 80
Message-ID: <mailman.1845.1676629651.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de dUQRvZJdA9sm0nMUiJrsng6BopAgJh4hooodYqoyXJmA==
Return-Path: <stephen_tucker@sil.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=sil.org header.i=@sil.org header.b=TpXikzfE;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.014
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '&gt;&gt;&gt;': 0.07;
'2023': 0.07; 'string': 0.07; 'float': 0.09; 'idle': 0.09;
'supplied': 0.09; 'log': 0.12; '&gt;': 0.14; 'url:mailman': 0.15;
'&gt;&gt;\xc2\xa0': 0.16; '(1.0': 0.16; '(yes': 0.16; '[snip]':
0.16; 'base.': 0.16; 'behaviour': 0.16; 'decimal': 0.16;
'integer': 0.16; 'integer,': 0.16; 'linearly': 0.16;
'mathematical': 0.16; 'wrote:': 0.16; 'python': 0.16; 'feb': 0.17;
'16,': 0.19; 'thu,': 0.19; 'tue,': 0.19; 'to:addr:python-list':
0.20; 'all,': 0.20; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'url-
ip:188.166/16': 0.25; 'brought': 0.26; '>>>': 0.28; 'expect':
0.28; 'error': 0.29; 'url-ip:188/8': 0.31; 'question': 0.32;
'message-id:@mail.gmail.com': 0.32; 'unless': 0.32; 'but': 0.32;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'following': 0.35; 'thanks,': 0.36; 'received:209.85': 0.37;
'could': 0.38; 'received:209': 0.39; 'quite': 0.39; 'adding':
0.39; 'rest': 0.39; 'appears': 0.40; 'base': 0.40; 'case.': 0.40;
'serious': 0.40; 'should': 0.40; 'email': 0.63; 'between': 0.63;
'leading': 0.63; 'your': 0.64; 'right': 0.68; 'exactly': 0.68;
'further': 0.69; 'and,': 0.69; 'figures': 0.69; 'skip:1 40': 0.69;
'you.': 0.71; 'attention': 0.71; 'skip:4 10': 0.75; 'yes': 0.76;
'significant': 0.78; 'again:': 0.84; 'deficiency': 0.84; 'oscar':
0.84; 'consisting': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sil.org; s=google;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=RaunpMLOeDrpl6nawZRk592MNPnf/uIjYY9Me91XKaQ=;
b=TpXikzfEaz8PuHirLfNspOlERcRPIGi9bQPUME/eyULB2CH76BxalLz+t8/usCZIGG
vSYUD06CdjfSm2SjAbCD/swRO972cRE9Zfk36PU1MkXMQnKZKzbptT6JDadZo7aCJwFy
N/qzCINZDyPz6KbqNvyEcYSSFTEsVN+y6O7Co=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=RaunpMLOeDrpl6nawZRk592MNPnf/uIjYY9Me91XKaQ=;
b=zMrudKSUW/BzeXh8Wd2c4UV7kpK0eiR4i3kS5/+bfFlNPUAApxQaDp/yedA/+Hdp4M
1YSWN+nUCystGV4NDAGstrlZ8I+GheEDFannzLP9GQyFLoTnLKtmtv7NCGMwRf6sUjvz
Ou0LN87BHyqMrY/le7kpdxz/T2XWDh4FXcihmByt9rTdKjkkZ/Z7C4gaFAgZTOi+lvAq
CC9Az7+7ltskPqJ51DJBIbywgO0U92MxQPMD1SvNXBLpbi8N4GY0kMbyBpPUTCRdcljw
aV9d4iTgYSjKkPiCUrGa08fElwnKWWW+posSS9nuzHC66drO56Plp/BsYGee3Zju/Z1W
RnCQ==
X-Gm-Message-State: AO0yUKUYUWi7C8ourb21E7aFGBpVfYQS+D1PRLgqNWrymsIJeAwZawnz
z83vm/XwWGfnK9znxJiF0Gqd1u/0TPbDjXyJismCPNA+GVgIjA==
X-Google-Smtp-Source: AK7set81yhU8+/Wq7h5wKKWK9lfUf+fWLvsSC+AfBF+2wsew/NxoCvpr9e5+GL0laKMbcU+Gcntqzz/mfTNNUT1E3aM=
X-Received: by 2002:aa7:8c18:0:b0:5a8:5821:b95 with SMTP id
c24-20020aa78c18000000b005a858210b95mr66731pfd.10.1676629647315; Fri, 17 Feb
2023 02:27:27 -0800 (PST)
In-Reply-To: <k57132F3e1U1@mid.individual.net>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
 by: Stephen Tucker - Fri, 17 Feb 2023 10:27 UTC

Thanks, one and all, for your reponses.

This is a hugely controversial claim, I know, but I would consider this
behaviour to be a serious deficiency in the IEEE standard.

Consider an integer N consisting of a finitely-long string of digits in
base 10.

Consider the infinitely-precise cube root of N (yes I know that it could
never be computed unless N is the cube of an integer, but this is a
mathematical argument, not a computational one), also in base 10. Let's
call it RootN.

Now consider appending three zeroes to the right-hand end of N (let's call
it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).

The *only *difference between RootN and RootNZZZ is that the decimal point
in RootNZZZ is one place further to the right than the decimal point in
RootN.

None of the digits in RootNZZZ's string should be different from the
corresponding digits in RootN.

I rest my case.

Perhaps this observation should be brought to the attention of the IEEE. I
would like to know their response to it.

Stephen Tucker.

On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
wrote:

> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
> > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org>
> wrote:
> [snip]
> >> I have just produced the following log in IDLE (admittedly, in Python
> >> 2.7.10 and, yes I know that it has been superseded).
> >>
> >> It appears to show a precision tail-off as the supplied float gets
> bigger.
> [snip]
> >>
> >> For your information, the first 20 significant figures of the cube root
> in
> >> question are:
> >> 49793385921817447440
> >>
> >> Stephen Tucker.
> >> ----------------------------------------------
> >> >>> 123.456789 ** (1.0 / 3.0)
> >> 4.979338592181744
> >> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
> >> 49793385921817.36
> >
> > You need to be aware that 1.0/3.0 is a float that is not exactly equal
> > to 1/3 ...
> [snip]
> > SymPy again:
> >
> > In [37]: a, x = symbols('a, x')
> >
> > In [38]: print(series(a**x, x, Rational(1, 3), 2))
> > a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
> >
> > You can see that the leading relative error term from x being not
> > quite equal to 1/3 is proportional to the log of the base. You should
> > expect this difference to grow approximately linearly as you keep
> > adding more zeros in the base.
>
> Marvelous. Thank you.
>
>
> --
> To email me, substitute nowhere->runbox, invalid->com.
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Re: Precision Tail-off?

<mailman.1846.1676631684.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21719&group=comp.lang.python#21719

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: stephen_...@sil.org (Stephen Tucker)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 11:01:06 +0000
Lines: 102
Message-ID: <mailman.1846.1676631684.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<CAP=-cKUhwGzwkOP5+n6=4fay-NXxCj9LtXrR4RCVs3tt1WXgdQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de D4h9zphqM4Sv9ybK1vKthwBVwB2uVYkqbys6dPsSNiaQ==
Return-Path: <stephen_tucker@sil.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=sil.org header.i=@sil.org header.b=LHXsC2w1;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.009
X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '17,': 0.04;
'&gt;&gt;&gt;': 0.07; '2023': 0.07; 'string': 0.07; 'float': 0.09;
'idle': 0.09; 'skip:1 50': 0.09; 'supplied': 0.09; 'log': 0.12;
'&gt;': 0.14; 'url:mailman': 0.15; '&gt;&gt;\xc2\xa0': 0.16;
'(1.0': 0.16; '(yes': 0.16; '[snip]': 0.16; 'base.': 0.16;
'behaviour': 0.16; 'decimal': 0.16; 'idle,': 0.16; 'integer':
0.16; 'integer,': 0.16; 'linearly': 0.16; 'math.e': 0.16;
'mathematical': 0.16; 'wrote:': 0.16; 'python': 0.16; 'feb': 0.17;
'16,': 0.19; 'thu,': 0.19; 'tue,': 0.19; 'to:addr:python-list':
0.20; 'all,': 0.20; 'fri,': 0.22; 'url-ip:188.166.95.178/32':
0.25; 'url-ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'url-
ip:188.166/16': 0.25; 'brought': 0.26; '>>>': 0.28; 'expect':
0.28; 'error': 0.29; 'url-ip:188/8': 0.31; 'question': 0.32;
'message-id:@mail.gmail.com': 0.32; 'unless': 0.32; 'but': 0.32;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'following': 0.35; 'thanks,': 0.36; 'received:209.85': 0.37;
'could': 0.38; 'received:209': 0.39; 'quite': 0.39; 'adding':
0.39; 'rest': 0.39; 'appears': 0.40; 'base': 0.40; 'case.': 0.40;
'serious': 0.40; 'should': 0.40; 'email': 0.63; 'between': 0.63;
'leading': 0.63; 'information:': 0.64; 'your': 0.64; 'right':
0.68; 'exactly': 0.68; 'skip:i 40': 0.68; 'further': 0.69; 'and,':
0.69; 'figures': 0.69; 'skip:1 40': 0.69; 'you.': 0.71;
'attention': 0.71; 'skip:4 10': 0.75; 'yes': 0.76; 'significant':
0.78; 'follow-up': 0.84; 'again:': 0.84; 'deficiency': 0.84;
'oscar': 0.84; 'consisting': 0.91; 'skip:( 50': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sil.org; s=google;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=zBNejWItY8JMGvg08Tli3ZMlw1/TalzvJi1+uwlOUW8=;
b=LHXsC2w1kEr4eYvjQzltrRaWTJi+aQeyVjRo6bF45z2b/yW3BOflaSKuUbIEOS4dQR
qCc/DCJu0BSyDQdwyqkfvD6wktzrxOQgjjbZjCEq2OfK03oTd6YL0IJ1VdPdzdmV/Jll
w/YM89W4VBDLCjQC33M/the0HDbW+y5T7pxZc=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=zBNejWItY8JMGvg08Tli3ZMlw1/TalzvJi1+uwlOUW8=;
b=HIIjAOtYcE18zV/O91pHfhhIuWn5UbVy4qSK0H+BVDdq4qONfvzZPOvjzrjVUjk4bT
vtqIGkFfZryd/Cw/XVoecFErrDqLZA0JyDlFzgZxMPwTq31sys+mUrb0r/Ysf5tYfZhH
YriHMeiyEb2L0JAFB+8ruySBYD2XknCFaCsl3u2XrpADiAirHjr2kRmaFKJoGR99hbuA
MJjsBpeAWauUsXgtPj3J32FZCM2CHcbNT6RHJ/9PqVcLAbhSEZYkdilxWCtOoawcgTKv
pEkT2VpGxrhHrt4xwaBZQK5hNab85f2cwRO0jXLMFNT6jjn3gDaZQjMye6QjAov5HQu9
Q1TA==
X-Gm-Message-State: AO0yUKXevBJsSFi3VxLRf0/sZ0/AzYx6V4u+38d6GzWuT9qG1GDVPAiS
XEfBALRhJEdMUbcPf2hug5qTdFMkESspL+MN9C1vN2TOyWKHrLrX
X-Google-Smtp-Source: AK7set8Uzv45kkxm8eEbqJpv+4exqNveYgZCwfxI2KayOb2GNVmA2VP62z1qdGAB5TekIbqlE5VhDS613RCXNR8Cr2U=
X-Received: by 2002:a17:90b:384e:b0:233:d280:1f38 with SMTP id
nl14-20020a17090b384e00b00233d2801f38mr1446591pjb.80.1676631681255; Fri, 17
Feb 2023 03:01:21 -0800 (PST)
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAP=-cKUhwGzwkOP5+n6=4fay-NXxCj9LtXrR4RCVs3tt1WXgdQ@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Stephen Tucker - Fri, 17 Feb 2023 11:01 UTC

As a follow-up to my previous message, I have just produced the following
log on IDLE, for your information:
------------------------------
>>> math.e ** (math.log
(123456789000000000000000000000000000000000000000000) / 3)
4.979338592181741e+16
>>> 10 ** (math.log10 (123456789000000000000000000000000000000000000000000)
/ 3)
4.979338592181736e+16
>>> 123456789000000000000000000000000000000000000000000 ** (1.0 / 3.0)
4.979338592181734e+16
>>> 123456789e42 ** (1.0 / 3.0)
4.979338592181734e+16
------------------------------

Stephen Tucker.

On Fri, Feb 17, 2023 at 10:27 AM Stephen Tucker <stephen_tucker@sil.org>
wrote:

> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
>
> Consider an integer N consisting of a finitely-long string of digits in
> base 10.
>
> Consider the infinitely-precise cube root of N (yes I know that it could
> never be computed unless N is the cube of an integer, but this is a
> mathematical argument, not a computational one), also in base 10. Let's
> call it RootN.
>
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).
>
> The *only *difference between RootN and RootNZZZ is that the decimal
> point in RootNZZZ is one place further to the right than the decimal point
> in RootN.
>
> None of the digits in RootNZZZ's string should be different from the
> corresponding digits in RootN.
>
> I rest my case.
>
> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.
>
> Stephen Tucker.
>
>
> On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
> wrote:
>
>> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
>> > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org>
>> wrote:
>> [snip]
>> >> I have just produced the following log in IDLE (admittedly, in Python
>> >> 2.7.10 and, yes I know that it has been superseded).
>> >>
>> >> It appears to show a precision tail-off as the supplied float gets
>> bigger.
>> [snip]
>> >>
>> >> For your information, the first 20 significant figures of the cube
>> root in
>> >> question are:
>> >> 49793385921817447440
>> >>
>> >> Stephen Tucker.
>> >> ----------------------------------------------
>> >> >>> 123.456789 ** (1.0 / 3.0)
>> >> 4.979338592181744
>> >> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
>> >> 49793385921817.36
>> >
>> > You need to be aware that 1.0/3.0 is a float that is not exactly equal
>> > to 1/3 ...
>> [snip]
>> > SymPy again:
>> >
>> > In [37]: a, x = symbols('a, x')
>> >
>> > In [38]: print(series(a**x, x, Rational(1, 3), 2))
>> > a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
>> >
>> > You can see that the leading relative error term from x being not
>> > quite equal to 1/3 is proportional to the log of the base. You should
>> > expect this difference to grow approximately linearly as you keep
>> > adding more zeros in the base.
>>
>> Marvelous. Thank you.
>>
>>
>> --
>> To email me, substitute nowhere->runbox, invalid->com.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>

Re: Precision Tail-off?

<mailman.1847.1676642429.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21720&group=comp.lang.python#21720

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: lis...@tompassin.net (Thomas Passin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 08:51:55 -0500
Lines: 97
Message-ID: <mailman.1847.1676642429.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de xVC4YJAayTKMeWXEGQNbVgond39HGEudEJrnQtiaXqVw==
Return-Path: <list1@tompassin.net>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=tompassin.net header.i=@tompassin.net header.b=ghuKYHc+;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'library.': 0.05; 'math':
0.05; '2023': 0.07; 'debugging': 0.07; 'string': 0.07; 'cases.':
0.09; 'float': 0.09; 'floating': 0.09; 'idle': 0.09; 'supplied':
0.09; 'log': 0.12; 'url:mailman': 0.15; '(1.0': 0.16; '(yes':
0.16; '>>>>': 0.16; '>>>>>>>': 0.16; '[snip]': 0.16; 'base.':
0.16; 'behaviour': 0.16; 'decimal': 0.16; 'integer': 0.16;
'integer,': 0.16; 'linearly': 0.16; 'mathematical': 0.16;
'received:10.0.0': 0.16; 'received:64.90': 0.16;
'received:64.90.62': 0.16; 'received:64.90.62.162': 0.16;
'received:dreamhost.com': 0.16; 'right.': 0.16; 'trap': 0.16;
'wrote:': 0.16; 'python': 0.16; 'feb': 0.17; '16,': 0.19;
'hardware': 0.19; 'libraries': 0.19; 'thu,': 0.19; 'tue,': 0.19;
'to:addr:python-list': 0.20; 'all,': 0.20; 'maybe': 0.22; 'run':
0.23; 'url-ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24':
0.25; 'url:listinfo': 0.25; 'url-ip:188.166/16': 0.25; 'binary':
0.26; 'brought': 0.26; '>>>': 0.28; 'expect': 0.28; 'error': 0.29;
'header:User-Agent:1': 0.30; 'am,': 0.31; 'url-ip:188/8': 0.31;
'question': 0.32; 'received:10.0': 0.32;
'received:mailchannels.net': 0.32;
'received:relay.mailchannels.net': 0.32; 'unless': 0.32; 'but':
0.32; 'there': 0.33; 'header:In-Reply-To:1': 0.34; 'trying': 0.35;
'following': 0.35; 'cases': 0.36; 'thanks,': 0.36; 'special':
0.37; 'could': 0.38; 'quite': 0.39; 'adding': 0.39; 'considering':
0.39; 'use': 0.39; 'rest': 0.39; 'appears': 0.40; 'base': 0.40;
'case.': 0.40; 'serious': 0.40; 'want': 0.40; 'should': 0.40;
'email': 0.63; 'between': 0.63; 'leading': 0.63; 'your': 0.64;
'among': 0.65; 'header:Received:6': 0.67; 'received:64': 0.67;
'right': 0.68; 'exactly': 0.68; 'further': 0.69; 'and,': 0.69;
'figures': 0.69; 'skip:1 40': 0.69; 'interest': 0.70; 'you.':
0.71; 'speed': 0.71; 'attention': 0.71; 'skip:4 10': 0.75; 'yes':
0.76; 'significant': 0.78; 'again:': 0.84; 'deficiency': 0.84;
'oscar': 0.84; 'reliability': 0.84; 'consisting': 0.91; 'stable':
0.93
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1676641916; a=rsa-sha256;
cv=none;
b=jxOADR8PGG9fq+F1/4C+sMrqaso7tA6Zd13sAk3+vMXXBIYRyFnDPVXYPvu0lYFWtQTv44
/xzsBp/NkMgr/yVBkmwLLDD2WoE+csTZSXHbQRiCrgFSurcJLUdol582J7Ry9sArcHTUJ4
owZlMxYbTowIjWMQ2Y+AV5hNfUcm8pNZF/ZkjBTtp+mOfrMqOL48Uh1j6MosMigFaZLvw0
W8i4KTbiYIsG2HOqunBt4AGx43jb8dz7lJIJ67xGSFYNs5tgxh6guPMRHd8yoxEk8lqCd7
0fUfZBD3/rHLB75jRY/0RtZE7bS5GDITytnWFf1PrFZq9A1PqggQ2K3m+kh+6A==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=mailchannels.net; s=arc-2022; t=1676641916;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:mime-version:mime-version:content-type:content-type:
content-transfer-encoding:content-transfer-encoding:
in-reply-to:in-reply-to:references:references:dkim-signature;
bh=1fqTOkICGvvTVPttI/Ju3o2VG6285zjbxMrFjXbi6PY=;
b=6/pBb2rdfpYQYIk8lE3MxFkvEnG1wbCbf9/mwuNgIP43cdzHkh2/Tw7HvSBE7NLw4VJAmW
okGXi5I3LHpOUVr7owVQ26t5kmw5L7yJuVuDX/sKnra9jKMDcw4qDef4yViuUMifIkx0nJ
CPBZrLY4ZSbXuliaOcghvtnpCx9EvmFSIFia8iey2sOteN195RL76QIVhbpnOXap4C1cN4
J9K7e9922sqPEa0RNrmIa8qKcC20x1Tr2ZTZY5qtKDZkVfZHig75uSknhRPcVnt296v4pj
9Cb9ecLOwAu1+fZY3aGedsnP3FcnFCd+F86lqmph3UwksiF7EUtHw/5dOV4FUA==
ARC-Authentication-Results: i=1; rspamd-b9c55767f-ngqs4;
auth=pass smtp.auth=dreamhost smtp.mailfrom=list1@tompassin.net
X-Sender-Id: dreamhost|x-authsender|tpassin@tompassin.net
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|tpassin@tompassin.net
X-MailChannels-Auth-Id: dreamhost
X-Wide-Eyed-Slimy: 1c88e9ae708afb3a_1676641917026_709265198
X-MC-Loop-Signature: 1676641917026:388896835
X-MC-Ingress-Time: 1676641917026
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tompassin.net;
s=dreamhost; t=1676641916;
bh=1fqTOkICGvvTVPttI/Ju3o2VG6285zjbxMrFjXbi6PY=;
h=Date:Subject:To:From:Content-Type:Content-Transfer-Encoding;
b=ghuKYHc+GUechgj7Pa18mcQ61n/UqxSYLdOQdiSt3VYnPZuSpmBLOOk6VPPO1krpB
nXXlQtyGT3F5gohpFw5fEeotdNrn7VSkCvYCQhc4R9r+FvDVvNGSCvhnvrqmie4YOa
xB4QG0BbRpMPoS09PzyQ3Dn2ftxBHsF7/kPseAOqdp9/wcEb+ufC6DwooH8Gleivxh
7rp+Zu9UbsTyfkUfAGN8EodnOd9KqSgxHtLgY3uf7fBA6iL8T6P5LXmJC2NefTkvdR
UoTvBnPMnaO5mmYfcjquVoCjMmtF/DGi/7H/gbGAHJO6iB7b8JOVeP1L1ax1gEi0Nb
X5ltt61+bP4NA==
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.7.2
Content-Language: en-US
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Thomas Passin - Fri, 17 Feb 2023 13:51 UTC

On 2/17/2023 5:27 AM, Stephen Tucker wrote:
> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
>
> Consider an integer N consisting of a finitely-long string of digits in
> base 10.

What you are not considering is that the IEEE standard is about trying
to achieve a balance between resource use (memory and registers),
precision, speed of computation, reliability (consistent and stable
results), and compatibility. So there have to be many tradeoffs. One
of them is the use of binary representation. It has never been about
achieving ideal mathematical perfection for some set of special cases.

Want a different set of tradeoffs? Fine, go for it. Python has Decimal
and rational libraries among others. They run more slowly than IEEE,
but maybe that's a good tradeoff for you. Use a symbolic math library.
Trap special cases of interest to you and calculate them differently.
Roll your own. Trouble is, you have to know one heck of a lot to roll
your own, and it may take decades of debugging to get it right. Even
then it won't have hardware assistance like IEEE floating point usually has.

> Consider the infinitely-precise cube root of N (yes I know that it could
> never be computed unless N is the cube of an integer, but this is a
> mathematical argument, not a computational one), also in base 10. Let's
> call it RootN.
>
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).
>
> The *only *difference between RootN and RootNZZZ is that the decimal point
> in RootNZZZ is one place further to the right than the decimal point in
> RootN.
>
> None of the digits in RootNZZZ's string should be different from the
> corresponding digits in RootN.
>
> I rest my case.
>
> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.
>
> Stephen Tucker.
>
>
> On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
> wrote:
>
>> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
>>> On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org>
>> wrote:
>> [snip]
>>>> I have just produced the following log in IDLE (admittedly, in Python
>>>> 2.7.10 and, yes I know that it has been superseded).
>>>>
>>>> It appears to show a precision tail-off as the supplied float gets
>> bigger.
>> [snip]
>>>>
>>>> For your information, the first 20 significant figures of the cube root
>> in
>>>> question are:
>>>> 49793385921817447440
>>>>
>>>> Stephen Tucker.
>>>> ----------------------------------------------
>>>>>>> 123.456789 ** (1.0 / 3.0)
>>>> 4.979338592181744
>>>>>>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
>>>> 49793385921817.36
>>>
>>> You need to be aware that 1.0/3.0 is a float that is not exactly equal
>>> to 1/3 ...
>> [snip]
>>> SymPy again:
>>>
>>> In [37]: a, x = symbols('a, x')
>>>
>>> In [38]: print(series(a**x, x, Rational(1, 3), 2))
>>> a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
>>>
>>> You can see that the leading relative error term from x being not
>>> quite equal to 1/3 is proportional to the log of the base. You should
>>> expect this difference to grow approximately linearly as you keep
>>> adding more zeros in the base.
>>
>> Marvelous. Thank you.
>>
>>
>> --
>> To email me, substitute nowhere->runbox, invalid->com.
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>

Re: Precision Tail-off?

<mailman.1848.1676645836.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21721&group=comp.lang.python#21721

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: gweathe...@uchc.edu (Weatherby,Gerard)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 14:39:42 +0000
Lines: 129
Message-ID: <mailman.1848.1676645836.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
<SJ0PR14MB58647B930C505B3192C5CE5BB9A19@SJ0PR14MB5864.namprd14.prod.outlook.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de yyhk8P4KkZYbZK6zXH84CwxhDn5Eqr/7o+5vroYhoy2w==
Return-Path: <prvs=0412dfa57b=gweatherby@uchc.edu>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=uchc.edu header.i=@uchc.edu header.b=RWf4dBHk;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '17,': 0.04; 'library.':
0.05; 'math': 0.05; '&gt;&gt;&gt;': 0.07; '2023': 0.07;
'debugging': 0.07; 'string': 0.07; 'cases.': 0.09; 'float': 0.09;
'floating': 0.09; 'idle': 0.09;
'received:nam12-dm6-obe.outbound.protection.outlook.com': 0.09;
'received:namprd14.prod.outlook.com': 0.09; 'supplied': 0.09;
'log': 0.12; '&gt;': 0.14; 'url:mailman': 0.15; '(1.0': 0.16;
'(yes': 0.16; '***': 0.16; '>>>>': 0.16; '>>>>>>>': 0.16;
'[snip]': 0.16; 'base.': 0.16; 'behaviour': 0.16; 'decimal': 0.16;
'integer': 0.16; 'integer,': 0.16; 'linearly': 0.16;
'mathematical': 0.16; 'right.': 0.16; 'standards,': 0.16; 'trap':
0.16; 'url:urldefense': 0.16; 'url:v3': 0.16; 'wrote:': 0.16;
'python': 0.16; 'feb': 0.17; '16,': 0.19; 'hardware': 0.19;
'libraries': 0.19; 'thu,': 0.19; 'tue,': 0.19; 'to:addr:python-
list': 0.20; 'all,': 0.20; 'maybe': 0.22; 'run': 0.23; 'to:name
:python-list@python.org': 0.24; 'url:listinfo': 0.25; 'binary':
0.26; 'brought': 0.26; 'friday,': 0.26; 'header:Received:9': 0.26;
'opening': 0.26; 'received:edu': 0.26; '>>>': 0.28; 'expect':
0.28; 'email addr:python.org&gt;': 0.28; 'error': 0.29; 'seem':
0.31; 'am,': 0.31; 'question': 0.32; 'python-list': 0.32;
'unless': 0.32; 'but': 0.32; 'there': 0.33; 'header:In-Reply-
To:1': 0.34; 'trying': 0.35; 'one.': 0.35; 'following': 0.35;
'cases': 0.36; 'thanks,': 0.36; 'received:filterd': 0.37;
'received:pps.filterd': 0.37; 'special': 0.37; 'url-ip:13.107/16':
0.38; 'could': 0.38; 'quite': 0.39; 'adding': 0.39; 'considering':
0.39; 'date:': 0.39; 'use': 0.39; 'rest': 0.39; 'appears': 0.40;
'base': 0.40; 'case.': 0.40; 'define': 0.40; 'gone': 0.40;
'serious': 0.40; 'want': 0.40; 'should': 0.40;
'charset:windows-1252': 0.60; 'including': 0.60; 'email.': 0.61;
'from:': 0.62; 'to:': 0.62; 'email': 0.63; 'between': 0.63;
'leading': 0.63; 're:': 0.64; 'your': 0.64; 'company': 0.64;
'among': 0.65; 'years': 0.65; 'url-ip:104.18/16': 0.67; 'right':
0.68; 'exactly': 0.68; 'further': 0.69; 'and,': 0.69; 'figures':
0.69; 'skip:1 40': 0.69; 'url-ip:52.6/16': 0.69; 'interest': 0.70;
'you.': 0.71; 'speed': 0.71; 'attention': 0.71; 'skip:4 10': 0.75;
'clicking': 0.76; 'yes': 0.76; 'significant': 0.78; 'links.':
0.81; 'again:': 0.84; 'attention:': 0.84; 'deficiency': 0.84;
'email name:&lt;python-list': 0.84; 'oscar': 0.84; 'reliability':
0.84; 'skip:& 50': 0.84; 'consisting': 0.91; 'stable': 0.93
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uchc.edu;
h=from : to : subject :
date : message-id : references : in-reply-to : content-type :
mime-version; s=UCHC03162020;
bh=QRnhBzmcJvK6+oCp7gle9Y5ugXsCr3+WUaTAiEg+7O0=;
b=RWf4dBHkSOQ2lrBbqDnm2IiH/A2e4YwnzDaiPu8gyrLBOYcq9JAP0t4qt1hl1Wdmmd1g
1xgFcXVzejM76rxUjn3ww1DyGEqMrA3BQ3l4RMNOW2oKaLLsg9CtwS8//ubl4AO3HSQr
B+hwDfng13/j4gpgSeQd9m4nOFaUwiUMsHiOqBjLUmGDrXRqsuehAnx2jwWx5gVjF+I5
qmO7HunM5O86FHgZc+znARkl1DvEnIyla4IRBemOMQqIleskalV8Or18+IJpNETLstqz
bPTUHrBXSTxMTI4Lt5FPCnsSsSPCnRj1+4vZfOme+wJBEBr8b7Dm9rJtML32+K0vPnjh +Q==
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
b=LzZgtIf8lMZLnQpSEE7UrGZYuIR3kwT5G5m8t82DOvuIZ6goOrVeB6lTesF+pK47Vp59Xbi8mxiJ/nD2K4HMzoAYj7Jdwuu+x48Wk4CIMbS+KT0YZhEmbqFyDMDZ+hWaCNeVYKB5HqHrFW6zXj8ihDPjLM+kf3dS6AAorif3V/yn02rlEJV0Ta6nsXa6eQHEFHF3DdZGLoOLWRJBjX1yXlApETKW3wYsGnD0KNqXbEyDNPSU8uAdGKgn5jN4+J1vLCkXOspdidJ9OpPQmtU3+HGFuLsEs6qbdNEVMbFeDITJ9C6zST5NjXuvoxa7YnS4Mxuii4Fr2J4X2QaxjVcUnw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector9901;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=QRnhBzmcJvK6+oCp7gle9Y5ugXsCr3+WUaTAiEg+7O0=;
b=d2Eqmn6GJcxupglYf5XNCloBCwKwdHFrsrDAlj7EfmveICzYfmMcxiknTHycmdCATwCYtPzhFgiQ9IqhsFWUgT2p6/u/K/BqeFLuStJoqUEjXQASfQzKe2HbSJ7TVMh6p2+CMEi38nu67svbjj69fcdk+8Azy7IOPTYQOnTYx52Fhy75ofq3yE+jgOvCF6yGQVtWLGvS3GhvCtbKma0kdnldGAdokPzRVTc5hUlzJXp6/Jzn2XOpfg01Q/LUtySesGWEEKC5OhIk5bHFAHmO1a1C4Jq5ZReZR8PYpzfRBCceh4dSNKZwfpwPmFq2PBGyiEaKwvsTir6P44kkc61rvA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=uchc.edu; dmarc=pass action=none header.from=uchc.edu;
dkim=pass header.d=uchc.edu; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uchc.onmicrosoft.com;
s=selector2-uchc-onmicrosoft-com;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=QRnhBzmcJvK6+oCp7gle9Y5ugXsCr3+WUaTAiEg+7O0=;
b=rzS2p0R2MWSqm6PmhUe50MphYEDOZW/i5bEdaFz3+RJdOi7RLm0+HI3uWT1bUr3cSZduTcnxA0cURiZtXele7DhNAxS0im9GiVZeO/2BZyh1vDtU/pipXY+qF4tnjuTHSQ+wlraVDvmVlQkBcr3LduPCqE9YAa/mTBuAqmhfqhA=
Thread-Topic: Precision Tail-off?
Thread-Index: AQHZQEOVyqbd3/ljJUiuH2YtzLpX1a7OS0cAgAOjYzKAAQWVAIAAOTeAgAALcAo=
In-Reply-To: <25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: SJ0PR14MB5864:EE_|PH0PR14MB4376:EE_
x-ms-office365-filtering-correlation-id: 4fcf39e2-9b70-40da-2ebc-08db10f4ce52
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: LhN7ydZIRK3O9dRUbJqoqNgkSgHmT9iA65c2pBqK7kICtU8AsGLEvWbGq0CJ+CGouTwGPijvGvqoEuKF6ypXN4ChM1LeQ9vwf4Et0T6qJvDS7SuLIAyAZUTugnp9pgimV+Nz/0pCusqe90BTLIjUJSQKkW/zQydvN6HIFGw7B2fhPUr9mNR6Y5wOAxJ7DmvR6gxw6O4Pj/cqXaM/GrivLEOqb/bSNFfhT7StSeKXgYvLvuOeiJTALAzINBpIbSbXOad2zsBPpjEG36QS7EKKFGtbd+heOAUpiXlnfTq/DGhyPDMcSwLIt2kmxhcwGzxnLlAGXsncagE4QxDMNKrnq4f18CIPIG8ouarRSPj1M4Cwf9HKQDFMbkLcVt7TGjBLLvWFZiRyzgh5ZOMWR1UOQxs8VxdhPCB24aYNU9RS+Lua/F18X6Vni0n8PbgxFupfyc6DjGnaNQklQzbLlqRS0XApN0GJi3PHZRuCUKV6sgz9eMknDRJZEGS9UdxEuB0uRX8xqtlgV9gjqw1m3mUJMe9BcqOCWeNJtAjWurbCd6dt0JA4+JEfKFuYeZ8KhJTPehRjEohr8kkOsCSXH+ZMc7092T20s5hvjL/iWsqzh7KXVwpGUWNg04pmw7tAEvSvw6IDzxANn51kavLgcC5VxvVYr3biiL2P8PY+sn9vYj7cbjpAahIh8ea+0XV5JLg7
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:;
IPV:NLI; SFV:NSPM; H:SJ0PR14MB5864.namprd14.prod.outlook.com; PTR:; CAT:NONE;
SFS:(13230025)(4636009)(346002)(366004)(376002)(396003)(136003)(39850400004)(451199018)(66476007)(66446008)(66946007)(6916009)(76116006)(66556008)(64756008)(8676002)(52536014)(91956017)(786003)(8936002)(66899018)(5660300002)(316002)(2906002)(41300700001)(966005)(7696005)(55016003)(478600001)(71200400001)(6506007)(53546011)(9686003)(26005)(75432002)(186003)(83380400001)(166002)(3480700007)(38100700002)(122000001)(33656002)(86362001)(41320700001)(38070700005);
DIR:OUT; SFP:1101;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: NcqPcg6XjnFNlCKk5K4uW1PbSBwnFmBxXvq8lkGJQdwGHeW7I8THJhm9
g9mCIjNLdjqeR6raFLR05jRyvom2X8c1IR3F2NyJ0oTpnSvlLBw5SpPD
JhTjkGIWGpxlJlk0FapkJFqmT6vJi5SxsvDWGOTrZvdA/v5aB6Zr/EPK
shDwlYPpjdhzKb19AfF9ICEWPEji54VVJwEA/rbaUAkQ+ffP8p5qk/nu
6blJBzpC9d7l08KjyB7dfirP/gSEPxjJH7ioEw84DJhH22m+zXqbElQU
mxgLFeHW6WUH7XxQQ+wxTDbja2pCCA5OjgiNggsZbaJGHVjSq54MNjuH
bibJcXudiUxg+ZdyoOB0D0h5Ouv6KeuD6bBFdHiiUuQvOtrouPgKYeHu
J/POU23INrFWReqpn+KwUV5ZTHKrXMAYss6HlDtyxDc+K8CtL05eVtq7
AzmnvKj9IfK4jwNZtu5KgWR1eUIsm+o/91VjnvtU6IgQPKgZO9UmpDoo
UAgTrXTIx6dr8vxOAMtXWhbJ/mlVxUDJ8XPC4fNpNB6vndEA/NNcdp4g
HKdXw1s15MOeGwlkJD/A1uABrAOF53aSu9rCe8zc+alJBwaAZVCVlsEF
DXopK925fir2g9zkYag1X91bE4j0OOBCZMgFk4o2h73SKPmyMqx017Jk
CxDX9yPdu8HP2cWAPY4HTUQKCl2M3r7GkluEb8jE/OXTeK3LJn43TNvR
txRlg/yQz0lYdPUv0XFARXusqrLOw1eMyB6l8VX7GZUtJwF0PrQYspOa
pZrSW2dS8Ubr7LJlg+TpYGb8mJcpMdG0ZJCDFEYD92SuUmd14x/Mi7sM
ZM9zamhdNjRcJmr2/TLwtQc9+fR/4PuwY3eHlOLYPaHtZpIHuSHswAyC
uWlcpXtriTrUKsN5SyaHC5MdEtKtjC04beKpSPRk1rbCygiKcCtHUKnn
/cykCHdKLv3pKtgkZms368FxC85ADuAYCzFdkrsRZEgIBcmYH/zAX/rt
yz4aPSIfCyVpAMl/6Zj6jTLiOfPbK56+ayeTsRqcK7Dh9KyXT5CHM/vo
JphIrbY8ryzDcbVcfFh3XEkIF/+L/UciVGGGMRJGuT0M3zDE3bghqg2Q
Dm/DohweumDZ1JdZzmN1nnQwNyDF0/FfoGQ1KDZMi2dCcujhKrb/ukrK
2TNc256uYwXLR4pU5fXUjH+PQZAE1gZwGR09JZ8jut6FMCZK/GUgmuWl
9OqNlVoc8OUEnWqSAWTWLa44AfYxMBs7jyZvdwML9/GJBnsYdTE3EEij
rspLRk/fX3xytah/KKDnAhxsHex2mYvy97pV9+VYPc/nG3hjznJjGSMC
joDvciME91DKRXwZ+K16uNdAgbG3KftXwaYLhKnqTEWLmvhAFvEqZXhQ
eQICARifdstHQHAykEQDxu1F14AXuokS8K6RLWpDzT2IYOsOD402VMGx
fLZR9yDW2VQBfXA57U8juRvWRzVLiHDDla0rla3Th0fuNA4LksEb5UNd
5JCdwQQ104HAZkwxuChynIBAbUBJrFu0rctptw2UFqWNMAkhsZRPjbT0
vzZh3ljFf1/vl13s4vbTzey6/oF7yA8KA3B2Gl1IWCSeHx13Fl4dsw
==
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: SJ0PR14MB5864.namprd14.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 4fcf39e2-9b70-40da-2ebc-08db10f4ce52
X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Feb 2023 14:39:42.1989 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 5c82d83a-818a-4c16-b540-ded2344a7ad3
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: S5tSyJZvBsrUqymdScizoLegMF3kW4q8Wgc5p2VSmEI/t+W3b0JBgce8SbBv6v8kzgJtg5qeKu8T822bQSd2tw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR14MB4376
X-Proofpoint-ORIG-GUID: TGpRADnD7rbQRoZS1PapbGcls6NSjWos
X-Proofpoint-GUID: TGpRADnD7rbQRoZS1PapbGcls6NSjWos
X-Proofpoint-Virus-Version: vendor=baseguard
engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22
definitions=2023-02-17_09,2023-02-17_01,2023-02-09_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0
clxscore=1015 suspectscore=0
spamscore=0 malwarescore=0 priorityscore=1501 bulkscore=0 adultscore=0
impostorscore=0 lowpriorityscore=0 phishscore=0 mlxscore=0 mlxlogscore=867
classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000
definitions=main-2302170133
X-Content-Filtered-By: Mailman/MimeDel 2.1.39
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <SJ0PR14MB58647B930C505B3192C5CE5BB9A19@SJ0PR14MB5864.namprd14.prod.outlook.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
 by: Weatherby,Gerard - Fri, 17 Feb 2023 14:39 UTC

IEEE did not define a standard for floating point arithmetics. They designed multiple standards, including a decimal float point one. Although decimal floating point (DFP) hardware used to be manufactured, I couldn’t find any current manufacturers. There was a company that seemed to be active until a few years ago, but they seem to have gone dark: https://twitter.com/SilMinds

From: Python-list <python-list-bounces+gweatherby=uchc.edu@python.org> on behalf of Thomas Passin <list1@tompassin.net>
Date: Friday, February 17, 2023 at 9:02 AM
To: python-list@python.org <python-list@python.org>
Subject: Re: Precision Tail-off?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

On 2/17/2023 5:27 AM, Stephen Tucker wrote:
> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
>
> Consider an integer N consisting of a finitely-long string of digits in
> base 10.

What you are not considering is that the IEEE standard is about trying
to achieve a balance between resource use (memory and registers),
precision, speed of computation, reliability (consistent and stable
results), and compatibility. So there have to be many tradeoffs. One
of them is the use of binary representation. It has never been about
achieving ideal mathematical perfection for some set of special cases.

Want a different set of tradeoffs? Fine, go for it. Python has Decimal
and rational libraries among others. They run more slowly than IEEE,
but maybe that's a good tradeoff for you. Use a symbolic math library.
Trap special cases of interest to you and calculate them differently.
Roll your own. Trouble is, you have to know one heck of a lot to roll
your own, and it may take decades of debugging to get it right. Even
then it won't have hardware assistance like IEEE floating point usually has..

> Consider the infinitely-precise cube root of N (yes I know that it could
> never be computed unless N is the cube of an integer, but this is a
> mathematical argument, not a computational one), also in base 10. Let's
> call it RootN.
>
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).
>
> The *only *difference between RootN and RootNZZZ is that the decimal point
> in RootNZZZ is one place further to the right than the decimal point in
> RootN.
>
> None of the digits in RootNZZZ's string should be different from the
> corresponding digits in RootN.
>
> I rest my case.
>
> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.
>
> Stephen Tucker.
>
>
> On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
> wrote:
>
>> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
>>> On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org>
>> wrote:
>> [snip]
>>>> I have just produced the following log in IDLE (admittedly, in Python
>>>> 2.7.10 and, yes I know that it has been superseded).
>>>>
>>>> It appears to show a precision tail-off as the supplied float gets
>> bigger.
>> [snip]
>>>>
>>>> For your information, the first 20 significant figures of the cube root
>> in
>>>> question are:
>>>> 49793385921817447440
>>>>
>>>> Stephen Tucker.
>>>> ----------------------------------------------
>>>>>>> 123.456789 ** (1.0 / 3.0)
>>>> 4.979338592181744
>>>>>>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
>>>> 49793385921817.36
>>>
>>> You need to be aware that 1.0/3.0 is a float that is not exactly equal
>>> to 1/3 ...
>> [snip]
>>> SymPy again:
>>>
>>> In [37]: a, x = symbols('a, x')
>>>
>>> In [38]: print(series(a**x, x, Rational(1, 3), 2))
>>> a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
>>>
>>> You can see that the leading relative error term from x being not
>>> quite equal to 1/3 is proportional to the log of the base. You should
>>> expect this difference to grow approximately linearly as you keep
>>> adding more zeros in the base.
>>
>> Marvelous. Thank you.
>>
>>
>> --
>> To email me, substitute nowhere->runbox, invalid->com.
>> --
>> https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jqgolDJWMiHsy0l-fRvM6Flcs478R5LIidNh2fAfa3kuPrtqTm0FC6uQmnUuyWLNypQZd3PkzzGyRzZlkbA$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jqgolDJWMiHsy0l-fRvM6Flcs478R5LIidNh2fAfa3kuPrtqTm0FC6uQmnUuyWLNypQZd3PkzzGyRzZlkbA$>
>>

--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!jqgolDJWMiHsy0l-fRvM6Flcs478R5LIidNh2fAfa3kuPrtqTm0FC6uQmnUuyWLNypQZd3PkzzGyRzZlkbA$<https://urldefense.com/v3/__https:/mail.python..org/mailman/listinfo/python-list__;!!Cn_UX_p3!jqgolDJWMiHsy0l-fRvM6Flcs478R5LIidNh2fAfa3kuPrtqTm0FC6uQmnUuyWLNypQZd3PkzzGyRzZlkbA$>

Re: Precision Tail-off?

<k59mf9Fcm8kU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21722&group=comp.lang.python#21722

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: pkpear...@nowhere.invalid (Peter Pearson)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: 17 Feb 2023 15:57:29 GMT
Lines: 75
Message-ID: <k59mf9Fcm8kU1@mid.individual.net>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<mailman.1845.1676629651.20444.python-list@python.org>
X-Trace: individual.net 97KVbirE/hxFx0l8KTv4Pgo1KRvE82Jq45aDyHFNq5uulcEp/Y
Cancel-Lock: sha1:9Gm/ncidJQeSEFe45wQUwp0g1K0=
User-Agent: slrn/1.0.3 (Linux)
 by: Peter Pearson - Fri, 17 Feb 2023 15:57 UTC

On Fri, 17 Feb 2023 10:27:08, Stephen Tucker wrote:[Head-posting undone.]
> On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
> wrote:
>> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
>> > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker <stephen_tucker@sil.org>
>> wrote:
>> [snip]
>> >> I have just produced the following log in IDLE (admittedly, in Python
>> >> 2.7.10 and, yes I know that it has been superseded).
>> >>
>> >> It appears to show a precision tail-off as the supplied float gets
>> bigger.
>> [snip]
>> >>
>> >> For your information, the first 20 significant figures of the cube root
>> in
>> >> question are:
>> >> 49793385921817447440
>> >>
>> >> Stephen Tucker.
>> >> ----------------------------------------------
>> >> >>> 123.456789 ** (1.0 / 3.0)
>> >> 4.979338592181744
>> >> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
>> >> 49793385921817.36
>> >
>> > You need to be aware that 1.0/3.0 is a float that is not exactly equal
>> > to 1/3 ...
>> [snip]
>> > SymPy again:
>> >
>> > In [37]: a, x = symbols('a, x')
>> >
>> > In [38]: print(series(a**x, x, Rational(1, 3), 2))
>> > a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
>> >
>> > You can see that the leading relative error term from x being not
>> > quite equal to 1/3 is proportional to the log of the base. You should
>> > expect this difference to grow approximately linearly as you keep
>> > adding more zeros in the base.
>>
>> Marvelous. Thank you.
[snip]
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).
>
> The *only *difference between RootN and RootNZZZ is that the decimal point
> in RootNZZZ is one place further to the right than the decimal point in
> RootN.
>
> None of the digits in RootNZZZ's string should be different from the
> corresponding digits in RootN.
>
> I rest my case.
[snip]

I believe the pivotal point of Oscar Benjamin's explanation is
that within the constraints of limited-precision binary floating-point
numbers, the exponent of 1/3 cannot be represented precisely, and
is in practice represented by something slightly smaller than 1/3;
and accordingly, when you multiply your argument by 1000, its
not-quit-cube-root gets multiplied by something slightly smaller
than 10, which is why the number of figures matching the "right"
answer gets steadily smaller.

Put slightly differently, the crux of the problem lies not in the
complicated process of exponentiation, but simply in the failure
to represent 1/3 exactly. The fact that the exponent is slightly
less than 1/3 means that you would observe the steady loss of
agreement that you report, even if the exponentiation process
were perfect.

--
To email me, substitute nowhere->runbox, invalid->com.

RE: Precision Tail-off?

<mailman.1849.1676656018.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21723&group=comp.lang.python#21723

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From:
Newsgroups: comp.lang.python
Subject: RE: Precision Tail-off?
Date: Fri, 17 Feb 2023 12:46:52 -0500
Lines: 197
Message-ID: <mailman.1849.1676656018.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<001a01d942f7$d1ff38e0$75fdaaa0$@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de rvn5GyxWsJmAcETOfjeLSQkeLEdkzt0HpuEJMhAeOikA==
Return-Path: <avi.e.gross@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=WcPgIkd5;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '17,': 0.04; 'absolute':
0.05; 'fairly': 0.05; '2023': 0.07; 'all!': 0.07; 'cpu': 0.07;
'string': 0.07; 'suggestion': 0.07; 'byte': 0.09; 'comparison':
0.09; 'computing': 0.09; 'effectively': 0.09; 'float': 0.09;
'floating': 0.09; 'idle': 0.09; 'infinite': 0.09; 'language,':
0.09; 'meant': 0.09; 'methods,': 0.09; 'operators': 0.09;
'realistic': 0.09; 'received:108': 0.09; 'received:209.85.219':
0.09; 'shift': 0.09; 'spanish': 0.09; 'supplied': 0.09;
'terminal': 0.09; 'steps': 0.11; 'log': 0.12; 'url:mailman': 0.15;
'memory': 0.15; 'supported': 0.15; '(1.0': 0.16; '(yes': 0.16;
'[snip]': 0.16; 'arguments': 0.16; 'arithmetic': 0.16; 'base.':
0.16; 'behaviour': 0.16; 'bits': 0.16; 'calculations': 0.16;
'char': 0.16; 'decimal': 0.16; 'division': 0.16; 'efficiently.':
0.16; 'gigantic': 0.16; 'indeed': 0.16; 'integer': 0.16;
'integer,': 0.16; 'iso': 0.16; 'linearly': 0.16; 'mathematical':
0.16; 'measure,': 0.16; 'ones.': 0.16; 'planet': 0.16; 'primes.':
0.16; 'relatively': 0.16; 'somewhat': 0.16; 'standard,': 0.16;
'standards,': 0.16; 'things,': 0.16; 'together?': 0.16; 'wrote:':
0.16; 'python': 0.16; 'larger': 0.17; 'feb': 0.17; 'probably':
0.17; 'message-id:@gmail.com': 0.18; 'solve': 0.19; 'uses': 0.19;
'16,': 0.19; 'hardware': 0.19; 'thu,': 0.19; 'tue,': 0.19;
'to:addr:python-list': 0.20; 'all,': 0.20; 'language': 0.21;
'languages': 0.22; 'focused': 0.22; 'purposes': 0.22; 'teach':
0.22; 'version': 0.23; 'skip:- 10': 0.25; 'url-
ip:188.166.95.178/32': 0.25; 'url-ip:188.166.95/24': 0.25;
'url:listinfo': 0.25; 'programming': 0.25; 'url-ip:188.166/16':
0.25; 'space': 0.26; 'brought': 0.26; 'friday,': 0.26; 'leave':
0.27; 'old': 0.27; 'done': 0.28; '>>>': 0.28; 'expect': 0.28;
'computer': 0.29; 'it,': 0.29; 'error': 0.29; 'approach': 0.31;
'url-ip:188/8': 0.31; 'result,': 0.69; 'skip:1 40': 0.69;
'standards': 0.69; 'types,': 0.69; 'times': 0.69; 'within': 0.69;
'solutions': 0.70; 'you.': 0.71; 'knowing': 0.71; 'attention':
0.71; 'addition': 0.71; 'relevant': 0.73; 'skip:4 10': 0.75;
'features': 0.75; 'near': 0.76; 'features.': 0.76; 'languages,':
0.76; 'limits': 0.76; 'star': 0.76; 'vary': 0.76; 'yes': 0.76;
'sent:': 0.78; 'field': 0.78; 'significant': 0.78; 'happens':
0.84; 'practical': 0.84; 'again:': 0.84; 'asian': 0.84; 'billion':
0.84; 'billions': 0.84; 'body)': 0.84; 'deficiency': 0.84;
'diameter': 0.84; 'measurement': 0.84; 'oscar': 0.84; 'stressed':
0.84; 'striving': 0.84; 'type.': 0.84; 'consisting': 0.91;
'doing.': 0.91; 'flexible': 0.91; 'holds': 0.91; 'largely': 0.91;
'retain': 0.91; 'tend': 0.91; 'yours.': 0.91; 'unlimited': 0.93;
'agreed': 0.95; 'storage': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:from:to:cc:subject:date:message-id:reply-to;
bh=GN7map6KGiCy5OPgGNWEZUlAkPLVMbLflnl76Oc4m0c=;
b=WcPgIkd52tJyRjtD6NgOfm0lDQmEXlyf54mkRj3HezEU+5C5x20qQDyVd/cnQAPakR
n88CBzey8vFGu2C5KJtzh7JZGUMiaIT9ry2jQsx+4S0gcWGLLff1kRW1lAXutME7sBjT
Yp4g2Tjhgb2czSlHK4zsrRAfTivnHdPEFGW5om6yNGn2vIlHmN7JWNqRpySpQpS/7PcV
vlLCROazyzPzDdH5gJ9gkPMxzMrgRFCBnPdJdWLsHpK1/sOt0QJmm3jlqgypw/iO6OGZ
De8sdh7udEJLh2sW+Id9EJZLQdi0sqC5rBSESnhLuzO4usX8nabZ9TtRsLsYxDEZHYaR
iBUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=thread-index:content-language:content-transfer-encoding
:mime-version:message-id:date:subject:in-reply-to:references:to:from
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=GN7map6KGiCy5OPgGNWEZUlAkPLVMbLflnl76Oc4m0c=;
b=xL5YZYAo0XNEJ5YuunmLR5GjlYBCPWdrQWMN/zZdWGW1Y99uXqEFD/YaCBMeIczxFD
/8A33V23iK+b7uYnEpKPN2pbMR4P3O0UUPjJO8sCVYWyh8zUlf90A4xLpWyOjvXGa2fX
4r2mJKWnsRdTlE/VmNCqcmIj+4b1PTEVuk1X2PH1u0x9RB/9kx4MciZHu5+eRhYKk6m/
P4YT2mWu8av09i+hHKbpjxJqqQYUIZ/skLJ6ISznlV70l9OKSlr7j8Aa/DNNZ7YK5k0l
ynb5iEuIuQ5hNZw8oFyGq/2Df8xrAtOj6664RbUCuQR+m44Fw3+twFFdvZvEvGP+Ol9X
M9Ww==
X-Gm-Message-State: AO0yUKXY3G6MejdZP6b8c8ecX99Ir4OCyOOFX8RoxYCofAJDIlR1es/3
7HHQoPC5rb2PyG2HRaxhELgSd/F8Eto=
X-Google-Smtp-Source: AK7set9StE5JKl17AJuzqe4BNcdzBl5yIFUqeiPku91Htj0T2vlQdQzQGOVTI+ApJybBv8/ZvgiV9w==
X-Received: by 2002:a05:6214:d62:b0:56e:a0eb:9b28 with SMTP id
2-20020a0562140d6200b0056ea0eb9b28mr2444042qvs.3.1676656015598;
Fri, 17 Feb 2023 09:46:55 -0800 (PST)
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-Mailer: Microsoft Outlook 16.0
Content-Language: en-us
Thread-Index: AQH6ec1uYweKrVEFuuZGJT6ZdsxNQwJvfpEQAoJ30ewBOPwa6QEZlbdUrlbK+bA=
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <001a01d942f7$d1ff38e0$75fdaaa0$@gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: - Fri, 17 Feb 2023 17:46 UTC

Stephen,

What response do you expect from whatever people in the IEEE you want?

The specific IEEE standards were designed and agreed upon by groups working
in caveman times when the memory and CPU time were not so plentiful. The
design of many types, including floating point, had to work decently if not
perfectly so you stored data in ways the hardware of the time could process
it efficiently.

Note all kinds of related issues about what happens if you want an integer
larger than fits into 16 bits or 32 bits or even 64 bits. A Python integer
was designed to be effectively unlimited and uses as much storage as needed.
It can also get ever slower when doing things like looking for gigantic
primes. But it does not have overflow problems.

So could you design a floating point data type with similar features? It
would be some complex data structure that keeps track of the number of
bit/bytes/megabytes currently being used to store the mantissa or exponent
parts and then have some data structure that holds all the bits needed. When
doing any arithmetic like addition or division or more complex things, it
would need to compare the two objects being combined and calculate how to
perhaps expand/convert one to match the other and then do umpteen steps to
generate the result in as many pieces/steps as needed and create a data
structure that holds the result, optionally trimming off terminal parts not
needed or wanted. Then you would need all relevant functions that accept
regular floating point to handle these numbers and generate these numbers.

Can that be done well? Well, sure, but not necessarily WELL. Some would
point you to the Decimal type. It might take a somewhat different tack on
how to do this. But everything comes with a cost.

Perhaps the response from the IEEE would be that what they published was
meant for some purposes but not yours. It may be that a group needs to
formulate a new standard but leave the old ones in place for people willing
to use them as their needs are more modest.

As an analogy, consider the lowly char that stored a single character in a
byte. II mean good old ASCII but also EBCDIC and the ISO family like ISO
8859-1 and so on. Those standards focused in on the needs of just a few
languages and if you wanted to write something in a mix of languages, it
could be a headache as I have had time I had to shift within one document to
say ISO 8859-8 to include some Hebrew, and ISO 8859-3 for Esperanto and so
on while ISO8859-1 was fine for English, French, German, Spanish and many
others. For some purposes, I had to use encodings like shift JIS to do
Japanese as many Asian languages were outside what ISO was doing.

The solutions since then vary but tend to allow or require multiple bytes
per character. But they retain limits and if we ever enter a Star Trek
Universe with infinite diversity and more languages and encodings, we might
need to again enlarge our viewpoint and perhaps be even more wasteful of our
computing resources to accommodate them all!

Standards are often not made to solve ALL possible problems but to make
clear what is supported and what is not required. Mathematical arguments can
be helpful but practical considerations and the limited time available (as
these darn things can take YEARS to be agreed on) are often dominant.
Frankly, by the tie many standards, such as for a programming language, are
finalized, the reality in the field has often changed. The language may
already have been supplanted largely by others for new work, or souped up
with not-yet-standard features.

I am not against striving for ever better standards and realities. But I do
think a better way to approach this is not to reproach what was done but ask
if we can focus on the near-future and make it better.

Arguably, there are now multiple features out there such as Decimal and they
may be quite different. That often happens without a standard. But if you
now want everyone to get together and define a new standard that may break
some implementations, ...

As I see it, many computer courses teach the realities as well as the
mathematical fantasies that break down in the real world. One of those that
tend to be stressed is that floating point is not exact and that comparison
operators need to be used with caution. Often the suggestion is to subtract
one number from another and check if the result is fairly close to zero as
in the absolute value is less than an IEEE standard number where the last
few bits are ones. For more complex calculations where the errors can
accumulate, you may need to choose a small number with more such bits near
the end.

Extended precision arithmetic is perhaps cheaper now and can be done for a
reasonable number of digits. It probably is not realistic to do most such
calculations for billions of digits, albeit some of the calculations for the
first googolplex digits of pi might indeed need such methods, as soon as we
fin a way to keep that many digits in memory give the ten to the 80th or so
particles we think are in our observable universe. But knowing pi to that
precision may not be meaningful if an existing value already is so precise
that given an exact number for the diameter of something the size of the
universe (Yes, I know this is nonsense) you could calculate the
circumference (ditto) to less than the size (ditto) of a proton. Any errors
in such a measurement would be swamped by all kinds of things such as
uncertainties in what we can measure, or niggling details about how space
expands irregularly in the area as we speak and so on.

So if you want a new IEEE (or other such body) standard, would you be
satisfied with a new one for say a 16,384 byte monstrosity that holds
gigantic numbers with lots more precision, or hold out for a relatively
flexible and unlimited version that can be expanded until your computer or
planet runs out of storage room and provides answers after a few billion
years when used to just add two of them together?

-----Original Message-----
From: Python-list <python-list-bounces+avi.e.gross=gmail.com@python.org> On
Behalf Of Stephen Tucker
Sent: Friday, February 17, 2023 5:27 AM
To: python-list@python.org
Subject: Re: Precision Tail-off?

Thanks, one and all, for your reponses.

This is a hugely controversial claim, I know, but I would consider this
behaviour to be a serious deficiency in the IEEE standard.

Consider an integer N consisting of a finitely-long string of digits in base
10.

Consider the infinitely-precise cube root of N (yes I know that it could
never be computed unless N is the cube of an integer, but this is a
mathematical argument, not a computational one), also in base 10. Let's call
it RootN.

Now consider appending three zeroes to the right-hand end of N (let's call
it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).

The *only *difference between RootN and RootNZZZ is that the decimal point
in RootNZZZ is one place further to the right than the decimal point in
RootN.

None of the digits in RootNZZZ's string should be different from the
corresponding digits in RootN.

I rest my case.

Perhaps this observation should be brought to the attention of the IEEE. I
would like to know their response to it.

Stephen Tucker.

On Thu, Feb 16, 2023 at 6:49 PM Peter Pearson <pkpearson@nowhere.invalid>
wrote:

> On Tue, 14 Feb 2023 11:17:20 +0000, Oscar Benjamin wrote:
> > On Tue, 14 Feb 2023 at 07:12, Stephen Tucker
> > <stephen_tucker@sil.org>
> wrote:
> [snip]
> >> I have just produced the following log in IDLE (admittedly, in
> >> Python
> >> 2.7.10 and, yes I know that it has been superseded).
> >>
> >> It appears to show a precision tail-off as the supplied float gets
> bigger.
> [snip]
> >>
> >> For your information, the first 20 significant figures of the cube
> >> root
> in
> >> question are:
> >> 49793385921817447440
> >>
> >> Stephen Tucker.
> >> ----------------------------------------------
> >> >>> 123.456789 ** (1.0 / 3.0)
> >> 4.979338592181744
> >> >>> 123456789000000000000000000000000000000000. ** (1.0 / 3.0)
> >> 49793385921817.36
> >
> > You need to be aware that 1.0/3.0 is a float that is not exactly
> > equal to 1/3 ...
> [snip]
> > SymPy again:
> >
> > In [37]: a, x = symbols('a, x')
> >
> > In [38]: print(series(a**x, x, Rational(1, 3), 2))
> > a**(1/3) + a**(1/3)*(x - 1/3)*log(a) + O((x - 1/3)**2, (x, 1/3))
> >
> > You can see that the leading relative error term from x being not
> > quite equal to 1/3 is proportional to the log of the base. You
> > should expect this difference to grow approximately linearly as you
> > keep adding more zeros in the base.
>
> Marvelous. Thank you.
>
>
> --
> To email me, substitute nowhere->runbox, invalid->com.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list


Click here to read the complete article
Re: Precision Tail-off?

<mailman.1850.1676656509.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21724&group=comp.lang.python#21724

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: torr...@gmail.com (Michael Torrie)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 08:38:58 -0700
Lines: 35
Message-ID: <mailman.1850.1676656509.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<96e74bab-c8ee-621c-660e-07651b0081a8@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de 0/F+H8jVB0MkLeNxLAz+KwwenGtNBVddueymDrcwJ49w==
Return-Path: <torriem@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=dF4SXGI7;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: UNSURE 0.218
X-Spam-Level: **
X-Spam-Evidence: '*H*': 0.56; '*S*': 0.00; 'this:': 0.03; 'cpu': 0.07;
'converting': 0.09; 'floating': 0.09; 'numpy': 0.09; 'represents':
0.09; 'another.': 0.16; 'arbitrary': 0.16; 'behaviour': 0.16;
'decimal': 0.16; 'mitigate': 0.16; 'wrote:': 0.16; 'python': 0.16;
'probably': 0.17; 'message-id:@gmail.com': 0.18; 'to:addr:python-
list': 0.20; 'all,': 0.20; 'url:wiki': 0.23; 'tried': 0.26;
'binary': 0.26; 'brought': 0.26; 'fact': 0.28; 'it,': 0.29;
'error': 0.29; 'header:User-Agent:1': 0.30; 'module': 0.31;
'nature': 0.32; 'unless': 0.32; 'but': 0.32; 'there': 0.33;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'committee': 0.36; 'thanks,': 0.36;
'using': 0.37; "it's": 0.37; 'received:209.85': 0.37;
'received:192.168': 0.37; 'way': 0.38; 'could': 0.38;
'received:209': 0.39; 'quite': 0.39; 'this,': 0.39; 'ago': 0.39;
'use': 0.39; 'rest': 0.39; 'base': 0.40; 'serious': 0.40;
'something': 0.40; 'should': 0.40; 'format': 0.62; 'techniques':
0.62; 'simply': 0.63; 'willing': 0.64; 'clear': 0.64; 'remains':
0.64; 'your': 0.64; 'pay': 0.65; 'years': 0.65; 'numbers': 0.67;
'choose': 0.67; 'matter': 0.68; 'url-ip:208.80.154/24': 0.70;
'url-ip:208.80/16': 0.70; 'url:wikipedia': 0.70; 'interesting':
0.71; 'speed': 0.71; 'url-ip:208/8': 0.71; 'attention': 0.71;
'article': 0.73; 'accuracy': 0.74; 'accurate': 0.74; 'capacity':
0.76; 'implemented': 0.76; 'increased': 0.76; 'points': 0.84;
'assured': 0.84; 'deficiency': 0.84; 'penalty': 0.84; 'talked':
0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=Xiot2z6P2E4upvQGBybUD3p2/QWTByVD8nK73DYer0Y=;
b=dF4SXGI7p6pB7+/9tPTKcX1xtVGkukUWluvGLog+qPX9oRlI5h+Upe1RSfM3TLd8q9
9jgp5epNpycA7SeJ/qI96OKqkFFX/XNSNCg1OOl0hS852NeQu5cp8ON8APduZkkT1365
erJqhwUS8nRtgNi6eGcuGH8C5S4HvwKDgR3RoNrNuElkgcQxCAMs0xZNHvIdulUJOecj
THA3ulfuWVmxcDP7gHohKkuNd36P3V3g7wuAL9DEKAdu7ylfJik29aKJOiV+vH6RZl2r
iSc4LmdnBfS4Y5F6sB31L6L+g6asfnH0WfAKoBglDt8L+MRZoDig47AMNQtQ0EXRJUW1
VlFw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Xiot2z6P2E4upvQGBybUD3p2/QWTByVD8nK73DYer0Y=;
b=OYzRkPrVj3g5PAkkhY1bLdO3a2D4DN2umBNJZmWnc7AdkIMyo+MPOSSTftJ3+IHkJ6
+AYrfb9dJ4rpoYcyOqSurBwKORylCWoINfHsGEK/5HcBH7fkOe9etLAqDFxW6m7rdw8Z
uebdotYcaXwsTZsGrOAn/ORX2DT9dS28drkTrEmcXcBITw8YMNiz0oB9xhr0vDZBWIss
5QW8LdulkKhPtFAURD1SVpXF56xk66zsC1aHjkw0DzGVFPqpSh1sxqmvtZoBFp8s9R7P
5vwUodw29FfbrNqQ37zjtYcdRBYPcIrOk2wKNOkVBKN2ZG0YCgM2XksP/UAG0Td7eCJa
FvTQ==
X-Gm-Message-State: AO0yUKVO5qsGmVMjGCAKF1+UKHycCeNOEuPR52F8qFTZOH7SLRHlVihZ
i032fMCayZnxvOeQWUVZ+jK8lgC4MVs=
X-Google-Smtp-Source: AK7set/2tIpSvkRlH2cK25Uo8Zwy/VDYg3o/QRjbHP4YNxG8DlIsYjIRwTbG7POQZM813VY3nKgcxQ==
X-Received: by 2002:a05:6a20:6a0f:b0:af:b909:2b34 with SMTP id
p15-20020a056a206a0f00b000afb9092b34mr1146758pzk.41.1676648340988;
Fri, 17 Feb 2023 07:39:00 -0800 (PST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-Mailman-Approved-At: Fri, 17 Feb 2023 12:55:08 -0500
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <96e74bab-c8ee-621c-660e-07651b0081a8@gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Michael Torrie - Fri, 17 Feb 2023 15:38 UTC

On 2/17/23 03:27, Stephen Tucker wrote:
> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.

No matter how you do it, there are always tradeoffs and inaccuracies
moving from real numbers in base 10 to base 2. That's just the nature
of the math. Any binary floating point representation is going to have
problems. There are techniques for mitigating this:
https://en.wikipedia.org/wiki/Floating-point_error_mitigation
It's interesting to note that the article points out that floating point
error was first talked about in the 1930s. So no matter what binary
scheme you choose there will be error. That's just the nature of
converting a real from one base to another.

Also we weren't clear on this, but the IEEE standard is not just
implemented in software. It's the way your CPU represents floating point
numbers in silicon. And in your GPUs (where speed is preferred to
precision). So it's not like Python could just arbitrarily do something
different unless you were willing to pay a huge penalty for speed. For
example the decimal module which is arbitrary precision, but quite slow.

Have you tried the numpy cbrt() function? It is probably going to be
more accurate than using power to 0.3333.

> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.
Rest assured the IEEE committee that formalized the format decades ago
knew all about the limitations and trade-offs. Over the years CPUs have
increased in capacity and now we can use 128-bit floating point numbers
which mitigate some of the accuracy problems by simply having more
binary digits. But the fact remains that some rational numbers in
decimal are irrational in binary, so arbitrary decimal precision using
floating point is not possible.

Re: Precision Tail-off?

<mailman.1851.1676659340.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21725&group=comp.lang.python#21725

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: Rich...@Damon-Family.org (Richard Damon)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 13:42:18 -0500
Lines: 56
Message-ID: <mailman.1851.1676659340.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de FOwfiTh4xB9U555HA5in9wvl6oFodOTYS9PQz300cUhg==
Return-Path: <Richard@Damon-Family.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.085
X-Spam-Evidence: '*H*': 0.83; '*S*': 0.00; 'away.': 0.05; 'string':
0.07; 'damon': 0.09; 'floating': 0.09; '(yes': 0.16; 'behaviour':
0.16; 'decimal': 0.16; 'from:addr:damon-family.org': 0.16;
'from:addr:richard': 0.16; 'from:name:richard damon': 0.16;
'integer': 0.16; 'integer,': 0.16; 'mathematical': 0.16; 'message-
id:@Damon-Family.org': 0.16; 'powers': 0.16; 'resolution': 0.16;
'wrote:': 0.16; "aren't": 0.19; 'to:addr:python-list': 0.20;
'all,': 0.20; 'brought': 0.26; 'header:User-Agent:1': 0.30; 'am,':
0.31; 'format,': 0.32; 'point,': 0.32; 'unless': 0.32; 'but':
0.32; 'header:In-Reply-To:1': 0.34; 'developed': 0.35; 'thanks,':
0.36; 'people': 0.36; 'change': 0.36; 'those': 0.36;
'received:192.168': 0.37; 'could': 0.38; 'enough': 0.39; 'handle':
0.39; 'use': 0.39; 'rest': 0.39; 'base': 0.40; 'case.': 0.40;
'serious': 0.40; 'should': 0.40; 'format': 0.62; 'here': 0.62;
'between': 0.63; 'key': 0.64; 'number,': 0.64; 'richard': 0.64;
'thus': 0.64; 'your': 0.64; 'well': 0.65; 'numbers': 0.67;
'right': 0.68; 'further': 0.69; 'factor': 0.69; 'times': 0.69;
'1000': 0.70; 'attention': 0.71; 'deficiency': 0.84; 'fraction':
0.84; 'consisting': 0.91; 'storage': 0.95
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0)
Gecko/20100101 Thunderbird/102.7.2
Content-Language: en-US
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-Provags-ID: V03:K1:tpEbtU1qQ+Y1YkN8/8WAhbMFS9TnrNtkJyniBFhIuOEOZW1hNLs
xBybPgcZMEw+XMVHeG3T4kGIk9/Kqk7LJ63tSdi7ZtFQl7ECOssjFjldVRHF3rTr52NDBmz
+uST16b5w8kQ8bSLtf4mDU9YgdAQp9ubm0IClJaA9cQE/pvOgwbaiFZ5CAkNdXAEGM8cOxG
Xq4Nqjt2ekoFWG8RL34zw==
X-Spam-Flag: NO
UI-OutboundReport: notjunk:1;M01:P0:ux2/iQJcl+c=;mnM/hZZ/xEkS4sTRHINoSMJPUIN
wh5q/MpXxmdOBoyDQKWXA58cIQ8CfvyWneHShPvQo9jMg4A2Yb7516T659en8GoOezJWeYqiU
qzaLoY2H6gMYxZ27JPZdVAhMjNSjXIighOFQuA3fq2YzIjicAFxnJTXpisvm8ElH3sGF+TmmG
JbaE8gSnEYXOb5/bnTZAMaZYwFJ7UCUxUWohiz/lONof9y/hwB7V29suJfcbOcUIB1Gcmx7Qp
ogbbifPopK14ufXrAwL1ZGZA2FXqArSU68a6gpLLqtgzDP+eN/3WfegPYPpdDRwEh61YbUR3i
yCtiK9FzvpWxveYi/F9134jsy8xsx2DN4rlAwxre4ec2U7GtmQ369kwq0JUcTw2SWu47TOR/i
FGhrHciDXN8LHDRhG9Wt22t908w9l6MhY3EfR4HuW6dRg4YtvciNI/60qvJ2xUhCH+K3aY9kt
xjFUQRY3/Sk7CJCmUfZIONRyHuzOF1+EjzfHFNtYg/dcLvSRK5JzysFM23PVKv++DFFE3B1Dd
ODLsXiX57UmHwuUecsswdjSxQ3j/stwZ5hFumMpHHxZ5lllhqSycLdu1gEZEsMWRMoGrp7SN2
cDvgIE572ISVyt/nbKJdojY1jAATmsUrPakxr3iz/BeBpaH1f6mAw4pf5jGI3B/OZM2a/NJPF
ze9nVZtbXIRVJHbHV7oNXRLsu2XI+9a8nmsCK/Ilpg==
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Richard Damon - Fri, 17 Feb 2023 18:42 UTC

On 2/17/23 5:27 AM, Stephen Tucker wrote:
> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
>
> Consider an integer N consisting of a finitely-long string of digits in
> base 10.
>
> Consider the infinitely-precise cube root of N (yes I know that it could
> never be computed unless N is the cube of an integer, but this is a
> mathematical argument, not a computational one), also in base 10. Let's
> call it RootN.
>
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).

The key factor here is IEEE floating point is storing numbers in BINARY,
not DECIMAL, so a multiply by 1000 will change the representation of the
number, and thus the possible resolution errors.

Store you numbers in IEEE DECIMAL floating point, and the variations by
multiplying by powers of 10 go away.

>
> The *only *difference between RootN and RootNZZZ is that the decimal point
> in RootNZZZ is one place further to the right than the decimal point in
> RootN.

No, since the floating point number is stored as a fraction times a
power of 2, the fraction has changed as well as the power of 2.

>
> None of the digits in RootNZZZ's string should be different from the
> corresponding digits in RootN.

Only if the storage format was DECIMAL.

>
> I rest my case.
>
> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.

That is why they have developed the Decimal Floating point format, to
handle people with those sorts of problems.

They just aren't common enough for many things to have adopted the use
of it.

>
> Stephen Tucker.

--
Richard Damon

Re: Precision Tail-off?

<mailman.1853.1676660033.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21727&group=comp.lang.python#21727

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!lilly.ping.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: oscar.j....@gmail.com (Oscar Benjamin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 18:53:38 +0000
Lines: 71
Message-ID: <mailman.1853.1676660033.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<CAHVvXxQAjXFHoeukmWGZd+qUP4ETh5tbMpDi9==BJ_tUv5Hn-A@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de mlRs4GnCUf+yAFT7TK1z1AypZx0BSElnOwBlxJZP5rcg==
Return-Path: <oscar.j.benjamin@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=KsBqTWSR;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.040
X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; '(e.g.': 0.05; 'despite':
0.05; '2023': 0.07; 'intermediate': 0.07; 'deeper': 0.09;
'expression': 0.09; 'float': 0.09; 'floating': 0.09; 'smaller':
0.09; 'import': 0.15; '[snip]': 0.16; 'behaviour': 0.16;
'calculation': 0.16; 'expressions': 0.16; 'for.': 0.16;
'limitations.': 0.16; 'operation.': 0.16; 'operations,': 0.16;
'option.': 0.16; 'rounded': 0.16; 'wrote:': 0.16; 'problem': 0.16;
'feb': 0.17; 'to:addr:python-list': 0.20; 'all,': 0.20; 'input':
0.21; 'fri,': 0.22; 'way.': 0.22; 'code': 0.23; 'saying': 0.25;
'cannot': 0.25; 'brought': 0.26; 'sensitive': 0.26; 'error': 0.29;
'context': 0.32; 'specified': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'there': 0.33; 'particular': 0.33; 'same':
0.34; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'respect': 0.35; 'final': 0.35; 'from:addr:gmail.com': 0.35;
'thanks,': 0.36; 'received:209.85': 0.37; 'though': 0.37; 'way':
0.38; 'means': 0.38; 'received:209': 0.39; 'two': 0.39; 'changes':
0.39; 'necessary': 0.39; 'use': 0.39; 'evaluation': 0.39; 'base':
0.40; 'case.': 0.40; 'eager': 0.40; 'exact': 0.40; 'serious':
0.40; 'should': 0.40; 'here': 0.62; 'true': 0.63; 'full': 0.64;
'mainly': 0.64; 'operations.': 0.64; 'representing': 0.64; 'your':
0.64; 'parts': 0.65; 'well': 0.65; 'skip:1 20': 0.67; 'entire':
0.67; 'outside': 0.67; 'prevent': 0.67; 'operations': 0.68;
'repeatedly': 0.69; 'showed': 0.69; 'standards': 0.69;
'attention': 0.71; 'accuracy': 0.74; 'leads': 0.81; 'deficiency':
0.84; 'oscar': 0.84; 'represented': 0.84; 'scope': 0.84;
'standards.': 0.84; 'tiny': 0.84; 'whole.': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=Ul53bLi1UVIQDhlYEEEyTZOA8sVG5YDIrQ3f529A/Ys=;
b=KsBqTWSRHWYzPF4eiqWI/vBgyL8YWs9JW85Pgs3W/+2YyilM3ZTGL/ttNXBsfOptZo
wo8YiLXvxPGitsTBsm3J5jNvyqSBJAGnruCqVQNC3so+diVA4XXE6bEIAoeWgc4jbj23
qMZShOwiq3VXHPc8+VLno/uu2Edbg/I6h7c0tO05R8gPrg81ud2E3q/X4enD3WP59tYw
xZtIcY8l05lG8uABYmq58czrPzwL1n0dpq7gugGZnZOmd36pMhao8aDkFYZnnmijYIWq
Py+Ha4tmZiZQHN/ZwAMQzB6BjpRQE5RyBpfjDYWLAjoC6m3NTdLXumjRsnbudVtATbZ+
uUgQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=Ul53bLi1UVIQDhlYEEEyTZOA8sVG5YDIrQ3f529A/Ys=;
b=fQLpd9cZycQpDn28RfpPLP9TI6ipBmOzoLdj88kjZ7ioIlAreh3JfGji0YLpbehP/f
Kt530/pvJYE4UJxvRAxxpAUg8lZZ9nIqAJ09J0AI8HuocMnjXB4R3ksOqt20yrzoUfDC
eFqi99sXZ23uoylQY6mTI0jawTzLT2sS0QmpqzQws8o8G7CBH96fYR1+0+kJf6dTrHPw
XaI+p62kzgQ4mnrdzD5pE67x+OxdqFl5zFrIGqcoYY2P0fmqVXtpy72/rhLjgB5uEX7f
pUhfwHE3jMJx1nuLCEy5n877u1ueXM4FEZ1tRX3nBZLeRqUJqzUYecbNTY76HamAi9nx
UR6g==
X-Gm-Message-State: AO0yUKUBCjP6Z648/nwls6Zwz6sOkBLGYb8QKZfZdRUEsquCoMCUMXhT
CVhczj+M9+WD9c3lkhqiIgIqOATUpQWn5Fmt7Ot2gFfCWIY=
X-Google-Smtp-Source: AK7set9d6KofYwHMu48wLwC7lU8GjkJCull03yeeA8pqTLUxs2R2P8/j6lHQ727+s99ix1Gl7mAPE2oUI93Gun8ZCU8=
X-Received: by 2002:ac2:544f:0:b0:4d5:ca42:e443 with SMTP id
d15-20020ac2544f000000b004d5ca42e443mr784123lfn.12.1676660030012; Fri, 17 Feb
2023 10:53:50 -0800 (PST)
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAHVvXxQAjXFHoeukmWGZd+qUP4ETh5tbMpDi9==BJ_tUv5Hn-A@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Oscar Benjamin - Fri, 17 Feb 2023 18:53 UTC

On Fri, 17 Feb 2023 at 10:29, Stephen Tucker <stephen_tucker@sil.org> wrote:
>
> Thanks, one and all, for your reponses.
>
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
[snip]
>
> Perhaps this observation should be brought to the attention of the IEEE. I
> would like to know their response to it.

Their response would be that they are well aware of what you are
saying and knew about this already since before writing any standards.
The basic limitation of the IEEE standard in this respect is that it
describes individual operations rather than composite operations. Your
calculation involves composing operations, specifically:

result = x ** (n / d)

The problem is that there is more than one operation so we have to
evaluate this in two steps:

e = n / d
result = x ** e

Now the problem is that although n / d is correctly rounded e has a
small error because the exact value of n / d cannot be represented. In
the second operation taking this slightly off value of e as the
intended input means that the correctly rounded result for x ** e is
not the closest float to the true value of the *compound* operation.
The exponentiation operator in particular is very sensitive to changes
in the exponent when the base is large so the tiny error in e leads to
a more noticeable relative error in x ** e.

The only way to prevent this in full generality is to to have a system
in which no intermediate inexact operations are computed eagerly which
means representing expressions symbolically in some way. That is what
the SymPy code I showed does:

In [6]: from sympy import cbrt

In [7]: e = cbrt(123456789000000000000000000000000000000000)

In [8]: print(e)
100000000000*123456789**(1/3)

In [9]: e.evalf(50)
Out[9]: 49793385921817.447440261250171604380899353243631762

Because the *entire* expression is represented here *exactly* as e it
is then possible to evaluate different parts of the expression
repeatedly with different levels of precision and it is necessary to
do that for full accuracy in this case. Here evalf will use more than
50 digits of precision internally so that at the end you have a result
specified to 50 digits but where the error for the entire expression
is smaller than the final digit. If you give it a more complicated
expression then it will use even more digits internally for deeper
parts of the expression tree because that is what is needed to get a
correctly rounded result for the expression as a whole.

This kind of symbolic evaluation is completely outside the scope of
what the IEEE floating point standards are for. Any system based on
fixed precision and eager evaluation will show the same problem that
you have identified. It is very useful though to have a system with
fixed precision and eager evaluation despite these limitations. The
context for which the IEEE standards are mainly intended (e.g. FPU
instructions) is one in which fixed precision and eager evaluation are
the only option.

--
Oscar

Re: Precision Tail-off?

<mailman.1854.1676662728.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21729&group=comp.lang.python#21729

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 20:38:44 +0100
Lines: 98
Message-ID: <mailman.1854.1676662728.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<96e74bab-c8ee-621c-660e-07651b0081a8@gmail.com>
<20230217193844.6chboclcwcnpkwtn@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="xcdpmdxhpy4xc2fv"
X-Trace: news.uni-berlin.de o8XnAOU0oQoYLNKzst3U1QcblvAbeytOto/TxcOBIAiQ==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '(which': 0.04; 'content-
type:multipart/signed': 0.05; 'cpu': 0.07; '-0700,': 0.09;
'content-type:application/pgp-signature': 0.09; 'converting':
0.09; 'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'floating': 0.09; 'intel': 0.09; 'magical': 0.09; 'overhead':
0.09; 'processor': 0.09; 'represents': 0.09; '"creative': 0.16;
'__/': 0.16; 'base.': 0.16; 'behaviour': 0.16; 'bits': 0.16;
'challenge!"': 0.16; 'computations': 0.16; 'cpython': 0.16;
'decimal': 0.16; 'from:addr:hjp-python': 0.16; 'from:addr:hjp.at':
0.16; 'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16;
'holzer': 0.16; 'interpreter': 0.16; 'mitigate': 0.16; 'reality.':
0.16; 'rounded': 0.16; 'stross,': 0.16; 'subset': 0.16; 'url-
ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24': 0.16; 'url-
ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:':
0.16; 'python': 0.16; 'uses': 0.19; "aren't": 0.19; 'to:addr
:python-list': 0.20; 'all,': 0.20; 'maybe': 0.22; 'binary': 0.26;
'brought': 0.26; 'bit': 0.27; 'fact': 0.28; 'sense': 0.28; 'it,':
0.29; 'nature': 0.32; 'unless': 0.32; 'but': 0.32; "i'm": 0.33;
'there': 0.33; 'header:In-Reply-To:1': 0.34; 'meaning': 0.35;
'committee': 0.36; 'errors': 0.36; 'thanks,': 0.36; 'those': 0.36;
'using': 0.37; "it's": 0.37; 'way': 0.38; 'could': 0.38; 'means':
0.38; 'quite': 0.39; 'this,': 0.39; 'ago': 0.39; 'use': 0.39;
'rest': 0.39; 'base': 0.40; 'serious': 0.40; 'something': 0.40;
'should': 0.40; 'michael': 0.60; 'format': 0.62; 'received:212':
0.62; 'simply': 0.63; 'willing': 0.64; 'clear': 0.64; 'down':
0.64; 'involve': 0.64; 'remains': 0.64; 'your': 0.64;
'independent': 0.65; 'pay': 0.65; 'years': 0.65;
'received:userid': 0.66; 'numbers': 0.67; 'generally': 0.67;
'matter': 0.68; 'small,': 0.69; 'url-ip:212/8': 0.69; 'compared':
0.71; 'speed': 0.71; 'attention': 0.71; 'little': 0.73;
'accuracy': 0.74; 'yourself': 0.75; 'capacity': 0.76;
'implemented': 0.76; 'increased': 0.76; 'assured': 0.84;
'deficiency': 0.84; 'penalty': 0.84; 'phrased': 0.84;
'received:at': 0.84; 'surprised': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <96e74bab-c8ee-621c-660e-07651b0081a8@gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20230217193844.6chboclcwcnpkwtn@hjp.at>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<96e74bab-c8ee-621c-660e-07651b0081a8@gmail.com>
 by: Peter J. Holzer - Fri, 17 Feb 2023 19:38 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-02-17 08:38:58 -0700, Michael Torrie wrote:
> On 2/17/23 03:27, Stephen Tucker wrote:
> > Thanks, one and all, for your reponses.
> >
> > This is a hugely controversial claim, I know, but I would consider this
> > behaviour to be a serious deficiency in the IEEE standard.
>
> No matter how you do it, there are always tradeoffs and inaccuracies
> moving from real numbers in base 10 to base 2.

This is phrased ambiguosly. So just to clarify:

Real numbers are not in base 10. Or base 2 or base 37 or base e. A
positional system (which uses a base) is just a convenient way to write
a small subset of real numbers. By using any base you limit yourself to
rational numbers (no e or π or √2) and in fact only those rational
numbers where the denominator is a power of the base.

Converting numbers from one base to another with any finite precision
will generally involve rounding - so do that as little as possible.

> That's just the nature of the math. Any binary floating point
> representation is going to have problems.

Any decimal floating point representation is also going to have
problems.

There is nothing magical about base 10. It's just what we are used to
(which also means that we are used to the rounding errors and aren't
surprised by them as much).

> Also we weren't clear on this, but the IEEE standard is not just
> implemented in software. It's the way your CPU represents floating point
> numbers in silicon. And in your GPUs (where speed is preferred to
> precision). So it's not like Python could just arbitrarily do something
> different unless you were willing to pay a huge penalty for speed.

I'm pretty sure that compared to the interpreter overhead of CPython the
overhead of a software FP implementation (whether binary or decimal)
would be rather small, maybe negligible.

> > Perhaps this observation should be brought to the attention of the IEEE. I
> > would like to know their response to it.
> Rest assured the IEEE committee that formalized the format decades ago
> knew all about the limitations and trade-offs. Over the years CPUs have
> increased in capacity and now we can use 128-bit floating point numbers

The very first IEEE compliant processor (the Intel 8087) had an 80 bit
extended type (in fact it did all computations in 80 bit and only
rounded down to 64 or 32 bits when storing the result). By the 1990s, 96
and 128 bit was quite common.

> which mitigate some of the accuracy problems by simply having more
> binary digits. But the fact remains that some rational numbers in
> decimal are irrational in binary,

Be careful: "Rational" and "irrational" have a standard meaning in
mathematics and it's independent of base.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Precision Tail-off?

<mailman.1855.1676663406.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21730&group=comp.lang.python#21730

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 20:50:03 +0100
Lines: 72
Message-ID: <mailman.1855.1676663406.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<20230217195003.fooxpbedbfk2cqe7@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="estsbjbnh4nvjlyh"
X-Trace: news.uni-berlin.de Q3JSZrLmAeQrB0/egv3G+QHHZPc55YcErzYQVhh8qLQw==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '(which': 0.04; 'content-
type:multipart/signed': 0.05; 'string': 0.07; 'content-
type:application/pgp-signature': 0.09; 'filename:fname piece:asc':
0.09; 'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; '"creative': 0.16; '(yes':
0.16; '1728': 0.16; '__/': 0.16; 'behaviour': 0.16; 'challenge!"':
0.16; 'computers': 0.16; 'decimal': 0.16; 'from:addr:hjp-python':
0.16; 'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'hjp@hjp.at': 0.16; 'holzer': 0.16; 'integer': 0.16; 'integer,':
0.16; 'mathematical': 0.16; 'reality.': 0.16; 'stross,': 0.16;
'unfortunate': 0.16; 'url-ip:212.17.106.137/32': 0.16; 'url-
ip:212.17.106/24': 0.16; 'url-ip:212.17/16': 0.16; 'url:hjp':
0.16; '|_|_)': 0.16; 'wrote:': 0.16; 'to:addr:python-list': 0.20;
'binary': 0.26; 'sense': 0.28; 'unless': 0.32; 'but': 0.32;
'there': 0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34;
'special': 0.37; 'really': 0.37; "it's": 0.37; 'hard': 0.37;
'could': 0.38; 'base': 0.40; 'serious': 0.40; 'something': 0.40;
'point.': 0.62; 'received:212': 0.62; 'between': 0.63; 'your':
0.64; 'received:userid': 0.66; 'numbers': 0.67; '[1]': 0.67;
'outside': 0.67; 'right': 0.68; 'further': 0.69; 'factor': 0.69;
'url-ip:212/8': 0.69; 'deficiency': 0.84; 'english.': 0.84;
'received:at': 0.84; 'shifted': 0.84; 'consisting': 0.91
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20230217195003.fooxpbedbfk2cqe7@hjp.at>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
 by: Peter J. Holzer - Fri, 17 Feb 2023 19:50 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-02-17 10:27:08 +0000, Stephen Tucker wrote:
> This is a hugely controversial claim, I know, but I would consider this
> behaviour to be a serious deficiency in the IEEE standard.
>
> Consider an integer N consisting of a finitely-long string of digits in
> base 10.
>
> Consider the infinitely-precise cube root of N (yes I know that it could
> never be computed

However, computers exist to compute. Something which can never be
computed is outside of the realm of computing.

> unless N is the cube of an integer, but this is a mathematical
> argument, not a computational one), also in base 10. Let's call it
> RootN.
>
> Now consider appending three zeroes to the right-hand end of N (let's call
> it NZZZ) and NZZZ's infinitely-precise cube root (RootNZZZ).
>
> The *only *difference between RootN and RootNZZZ is that the decimal point
> in RootNZZZ is one place further to the right than the decimal point in
> RootN.

No. In mathematics there is no such thing as a decimal point. The only
difference is that RootNZZZ is RootN*10. But there is nothing special
about 10. You could multiply your original number by 512 and then the
new cube root would differ by a factor of 8 (which would show up as
shifted "binary point"[1] in binary but completely different digits in
decimal) or you could multiply by 1728 and then you would need base 12
to get the same digits with a shifted "duodecimal point".

hp

[1] It's really unfortunate that the point which separates the integer
and the fractional part of a number is called a "decimal point" in
English. Makes it hard to talk about non-integer numbers in other
bases.

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Precision Tail-off?

<mailman.1856.1676663913.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21731&group=comp.lang.python#21731

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 20:58:31 +0100
Lines: 44
Message-ID: <mailman.1856.1676663913.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
<SJ0PR14MB58647B930C505B3192C5CE5BB9A19@SJ0PR14MB5864.namprd14.prod.outlook.com>
<20230217195831.fwpq22444okfbps6@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="sm5pz5siiswuglm4"
X-Trace: news.uni-berlin.de aZUUjyx5TB8twx60tK7JjA2T6qot1L/K8vmfEnBGsXrg==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; 'couldn\xe2\x80\x99t': 0.07;
'content-type:application/pgp-signature': 0.09; 'filename:fname
piece:asc': 0.09; 'filename:fname piece:signature': 0.09;
'filename:fname:signature.asc': 0.09; 'float': 0.09; 'floating':
0.09; '"creative': 0.16; '__/': 0.16; 'challenge!"': 0.16;
'decimal': 0.16; 'from:addr:hjp-python': 0.16; 'from:addr:hjp.at':
0.16; 'from:name:peter j. holzer': 0.16; 'hjp@hjp.at': 0.16;
'holzer': 0.16; 'reality.': 0.16; 'standards,': 0.16; 'stross,':
0.16; 'url-ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24':
0.16; 'url-ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16;
'wrote:': 0.16; 'hardware': 0.19; 'implement': 0.19; 'to:addr
:python-list': 0.20; 'sense': 0.28; "doesn't": 0.32; 'header:In-
Reply-To:1': 0.34; 'one.': 0.35; 'define': 0.40; 'including':
0.60; 'remember': 0.61; 'received:212': 0.62; 'received:userid':
0.66; 'url-ip:212/8': 0.69; 'more?': 0.84; 'received:at': 0.84;
'ibm': 0.95
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <SJ0PR14MB58647B930C505B3192C5CE5BB9A19@SJ0PR14MB5864.namprd14.prod.outlook.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20230217195831.fwpq22444okfbps6@hjp.at>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<25b8f4da-880f-3e76-2d96-1d424a5ec7cd@tompassin.net>
<SJ0PR14MB58647B930C505B3192C5CE5BB9A19@SJ0PR14MB5864.namprd14.prod.outlook.com>
 by: Peter J. Holzer - Fri, 17 Feb 2023 19:58 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-02-17 14:39:42 +0000, Weatherby,Gerard wrote:
> IEEE did not define a standard for floating point arithmetics. They
> designed multiple standards, including a decimal float point one.
> Although decimal floating point (DFP) hardware used to be
> manufactured, I couldn’t find any current manufacturers.

Doesn't IBM any more? Their POWER processors used to implement decimal
FP (starting with POWER8, if I remember correctly).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Precision Tail-off?

<mailman.1857.1676666195.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21732&group=comp.lang.python#21732

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: grant.b....@gmail.com (Grant Edwards)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 12:36:31 -0800 (PST)
Lines: 30
Message-ID: <mailman.1857.1676666195.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<63efe54f.050a0220.4d78.3abb@mx.google.com>
X-Trace: news.uni-berlin.de Z1yt19CiRJAZDdz3Uxks7giEWauUrYQNDiP4MfxibMNg==
Return-Path: <grant.b.edwards@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=Mocx57D2;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.069
X-Spam-Evidence: '*H*': 0.86; '*S*': 0.00; '(for': 0.05; 'damon':
0.09; 'floating': 0.09; 'decimal': 0.16;
'from:addr:grant.b.edwards': 0.16; 'from:name:grant edwards':
0.16; 'received:209.85.166.53': 0.16; 'received:mail-
io1-f53.google.com': 0.16; 'resolution': 0.16; 'time)': 0.16;
'wrote:': 0.16; 'grant': 0.17; "aren't": 0.19; 'hardware': 0.19;
'to:addr:python-list': 0.20; 'stuff': 0.25; 'binary': 0.26;
'brought': 0.26; 'header:User-Agent:1': 0.30; 'format,': 0.32;
'same': 0.34; 'received:google.com': 0.34; 'developed': 0.35;
'received:209.85.166': 0.35; 'from:addr:gmail.com': 0.35;
'people': 0.36; 'those': 0.36; 'received:209.85': 0.37;
'received:209': 0.39; 'enough': 0.39; 'handle': 0.39; 'use': 0.39;
'should': 0.40; 'popular': 0.60; 'remember': 0.61; 'point.': 0.62;
'once': 0.63; 'richard': 0.64; 'let': 0.66; 'back': 0.67;
'choose': 0.67; 'attention': 0.71; 'little': 0.73; 'accounting,':
0.84; 'became': 0.84; 'chose': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:user-agent:references:subject:from:date:message-id:from:to:cc
:subject:date:message-id:reply-to;
bh=ZgC4SaWvDGK1eLEETcisOkowlzt1LW6/V7oO6JUITdw=;
b=Mocx57D2ItDEe5ol+yWbQg04VAXX2oZXPO1dv652oPS2y/Y3Joupzc5ayTkCjE7+id
5HCcuZN2+B2iq866cTiz9ipNTHx8oG4t9LlPRs8GpoUuyoeGr7NtZr/lFa+IPievBAG6
Gv/bbDjYCOM1HeyLlJYBRlOeP3G09Kmu9Bp8vf40YB57kGiaHCL+6E7AsTWzBKoopcqs
oiIVY6J2FavhQuf+zeagqhjWLRRL15GbzJkJ5DDQD0/xkF19cQlJZCp6rU/F0lbU3tle
9ZcD2e/Ku2tG6Kot6I0jBMO/8MG3pv4odDex+y7bXrnqBPulg2amCeJL4KQVg/nOJDyq
Xfcg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:user-agent:references:subject:from:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=ZgC4SaWvDGK1eLEETcisOkowlzt1LW6/V7oO6JUITdw=;
b=EMo/A+wKyCAJEq61ple7Qp/5+fRkfohB4YxuQoZZTqfJQmkJv1yblnyxBNipy6dABh
stja1LY3KPNnb7Z7p2v7/t0sAuiWIRYW2iCNvOMq+vg+Yt/QZeBT82a7mlBv4mCUujmo
TelEU3qJcLPmK6x9a0eKqSojqPJfVjqeeEZmHMTYzFKvnxIyM0ANHwzOddww5sVQ+/6Y
2gz/WBekP+Et/HcK5xZk71UW1BJfkPi+VWOlAS47clJV6CEzhkwLFPRZwy9HCMizpK3/
/a0Duq9VBP/4C/fZ0BA1OgAleQKc/16Byr10Ez+XBx1aI/xp5VBfRwfB5+PyVV7Uk6P2
0zmw==
X-Gm-Message-State: AO0yUKWBjIXWBbNY9SWyY2nSCfmLTw9uCop1IXDz+vZfbZvWG3DXL3X2
Vslj+q6NeKEhQGTuPlJZQoMb2rLBrOw=
X-Google-Smtp-Source: AK7set+3unHR+QwZIA4Y+qW7K6PvkctcqQ1b1rAz1AWVRAgI3lDYmGfrrhwSkjr4Wyam1+VHdy+sQA==
X-Received: by 2002:a5d:93d5:0:b0:744:9f1e:fe88 with SMTP id
j21-20020a5d93d5000000b007449f1efe88mr6098912ioo.18.1676666192143;
Fri, 17 Feb 2023 12:36:32 -0800 (PST)
User-Agent: slrn/1.0.3 (Linux)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <63efe54f.050a0220.4d78.3abb@mx.google.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
 by: Grant Edwards - Fri, 17 Feb 2023 20:36 UTC

On 2023-02-17, Richard Damon <Richard@Damon-Family.org> wrote:
> [...]
>
>> Perhaps this observation should be brought to the attention of the IEEE. I
>> would like to know their response to it.
>
> That is why they have developed the Decimal Floating point format, to
> handle people with those sorts of problems.
>
> They just aren't common enough for many things to have adopted the
> use of it.

Back before hardware floating point was common, support for deciaml
floating point was very common. All of the popular C, Pascal, and
BASIC compilers (for microcomputers) I remember let you choose (at
compile time) whether you wanted to use binary floating point or
decimal (BCD) floating point. People doing scientific stuff usually
chose binary because it was a little faster and you got more
resolution for the same amount of stoage. If you were doing
accounting, you chose BCD (or used fixed-point).

Once hardware (binary) floating point became common, support for
software BCD floating point just sort of went away...

--
Grant

Re: Precision Tail-off?

<mailman.1858.1676667537.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21733&group=comp.lang.python#21733

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: mat...@wichmann.us (Mats Wichmann)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 13:57:06 -0700
Lines: 34
Message-ID: <mailman.1858.1676667537.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de fGU7M/HVB5RKIw/kNTWLeAhtYEYQOl1c+8rq26pBHqog==
Return-Path: <mats@wichmann.us>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="1024-bit key; unprotected key"
header.d=pobox.com header.i=@pobox.com header.b=bezNONzb;
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.034
X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'away.': 0.05; 'comment:':
0.05; 'libraries.': 0.07; 'aligned': 0.09; 'damon': 0.09;
'floating': 0.09; 'intel': 0.09; 'treated': 0.09; 'received:173':
0.13; 'supported': 0.15; 'that.': 0.15; '(when': 0.16; '2008':
0.16; '754': 0.16; 'answer.': 0.16; 'arithmetic': 0.16; 'decimal':
0.16; 'gpu': 0.16; 'powers': 0.16; 'resolution': 0.16;
'standard,': 0.16; 'wrote:': 0.16; 'python': 0.16; 'hardware':
0.19; 'implement': 0.19; 'to:addr:python-list': 0.20; 'all,':
0.20; "i've": 0.22; 'lines': 0.23; "i'd": 0.24; 'again,': 0.26;
'else': 0.27; 'series': 0.28; 'header:User-Agent:1': 0.30;
'whole': 0.30; 'am,': 0.31; 'module': 0.31; 'forward,': 0.32;
'point,': 0.32; 'there': 0.33; 'particular': 0.33; 'header:In-
Reply-To:1': 0.34; 'people': 0.36; 'change': 0.36; 'really': 0.37;
"it's": 0.37; 'class': 0.37; 'received:192.168': 0.37; 'though':
0.37; 'way': 0.38; 'added': 0.39; 'mentioned': 0.39; 'finding':
0.39; 'consistent': 0.40; 'seen': 0.62; 'here': 0.62; 'feel':
0.63; 'once': 0.63; 'complete': 0.64; 'key': 0.64; 'number,':
0.64; 'richard': 0.64; 'thus': 0.64; 'numbers': 0.67; 'heard':
0.67; 'acceptable': 0.69; 'factor': 0.69; 'standards': 0.69;
'1000': 0.70; 'successful': 0.78; 'led': 0.81; 'perfect': 0.82;
'admit': 0.84; 'direction.': 0.84; 'editions': 0.84; 'eventually':
0.84; 'mutually': 0.84; 'and...': 0.91; 'somebody': 0.91; 'ibm':
0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=message-id
:date:mime-version:subject:to:references:from:in-reply-to
:content-type:content-transfer-encoding; s=sasl; bh=kuMGXMUmF63E
rhUkg3rxAJmjSlmu+F9ztHzUIsuu8zM=; b=bezNONzbWYMaxJE17VtnRS9vKIAL
5jo1OyXsZNnCKfSjhHncG0U6OXq9ySoq8FWl3hJpa3KJ0lI1QAGZsZ2lY9DcsXfT
0xgk0oNq1C9ZSz3XN+Sf5S2RqguR6RB7HcbRdsbR1wc1OUpqhfDq/HfhY4y7eYN/
+uX6J8ZwefaDRHU=
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=wichmann.us;
h=message-id:date:mime-version:subject:to:references:from:in-reply-to:content-type:content-transfer-encoding;
s=2018-07.pbsmtp; bh=kuMGXMUmF63ErhUkg3rxAJmjSlmu+F9ztHzUIsuu8zM=;
b=c0DiFBBn/x+dPNV6RWcqJmNDdOCRIgoi3mVBVWJNKQv4ZGiE2NCXgsYYq7ToeV/TSyP2EeSRxRPeK7ZWzmbkT27ibwuKjsZBlQimAaxX6lFQTZAlFYIfknAv/78UjATRt9qETNnhRJTYZqhA0wth1cQ0QhGx/jOgbwQVF5l1QtY=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.7.2
Content-Language: en-US
In-Reply-To: <1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
X-Pobox-Relay-ID: A4030208-AF05-11ED-8ED9-C2DA088D43B2-81526775!pb-smtp20.pobox.com
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
 by: Mats Wichmann - Fri, 17 Feb 2023 20:57 UTC

On 2/17/23 11:42, Richard Damon wrote:
> On 2/17/23 5:27 AM, Stephen Tucker wrote:

> The key factor here is IEEE floating point is storing numbers in BINARY,
> not DECIMAL, so a multiply by 1000 will change the representation of the
> number, and thus the possible resolution errors.
>
> Store you numbers in IEEE DECIMAL floating point, and the variations by
> multiplying by powers of 10 go away.

The development of the original IEEE standard led eventually to
consistent implementation in hardware (when they implement floating
point at all, which embedded/IoT class chips in particular often don't)
that aligned with how languages/compilers treated floating point, so
that's been a really successful standard, whatever one might feel about
the tradeoffs. Standards are all about finding a mutually acceptable way
forward, once people admit there is no One Perfect Answer.

Newer editions of 754 (since 2008) have added this decimal floating
point representation, which is supported by some software such as IBM
and Intel floating-point libraries. Hardware support has been slower to
arrive. The only ones I've heard of have been the IBM z series
(mainframes) and somebody else mentioned Power though I'd never seen
that. It's possible some of the GPU lines may be going this direction.

As far as Python goes... the decimal module has this comment:

> It is a complete implementation of Mike Cowlishaw/IBM's General
Decimal Arithmetic Specification.

Cowlishaw was the editor of the 2008 and 2019 editions of IEEE 754, fwiw.

And... this topic as a whole comes up over and over again, like
everywhere. See Stack Overflow for some amusement.

Re: Precision Tail-off?

<mailman.1859.1676671392.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21734&group=comp.lang.python#21734

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: grant.b....@gmail.com (Grant Edwards)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 14:03:09 -0800 (PST)
Lines: 30
Message-ID: <mailman.1859.1676671392.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
<63eff99d.020a0220.bec00.1d43@mx.google.com>
X-Trace: news.uni-berlin.de AloR0RxgGZ+997Cp81R/dQ1tO2zl0QpBOl/NfD5KKcSw==
Return-Path: <grant.b.edwards@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=SXTB5c60;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.164
X-Spam-Level: *
X-Spam-Evidence: '*H*': 0.68; '*S*': 0.00; 'this:': 0.03; 'floating':
0.09; 'bugs': 0.16; 'from:addr:grant.b.edwards': 0.16;
'from:name:grant edwards': 0.16; 'mats': 0.16; 'wichmann': 0.16;
'wrote:': 0.16; 'grant': 0.17; 'to:addr:python-list': 0.20;
'machine': 0.22; 'written': 0.22; 'help.': 0.25; 'again,': 0.26;
'header:User-Agent:1': 0.30; 'whole': 0.30; 'good.': 0.32;
'point,': 0.32; "didn't": 0.34; 'received:google.com': 0.34;
'"the': 0.35; 'received:209.85.166': 0.35; 'from:addr:gmail.com':
0.35; 'people': 0.36; 'using': 0.37; 'received:209.85': 0.37;
'way': 0.38; 'could': 0.38; 'read': 0.38; 'received:209': 0.39;
'ago': 0.39; 'wrote': 0.39; 'tell': 0.60; 'remember': 0.61;
'url:pdf': 0.62; 'full': 0.64; 'explained': 0.64; 'news': 0.65;
'years': 0.65; 'away': 0.67; 'url-ip:130/8': 0.69; 'implemented':
0.76; 'discovered': 0.80; 'peers': 0.84; 'pointing': 0.84;
'url:cd': 0.84; 'and...': 0.91
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:user-agent:references:subject:from:date:message-id:from:to:cc
:subject:date:message-id:reply-to;
bh=DDEQ02yzr8n8hcmTafXqSwG3Bubd76x70Tan8xib4Sc=;
b=SXTB5c60ohcpSjD34a3dmqbccD4EFzMgIap22NFYMC8NbuluYwL+wl7njfRUpQ6mlH
ltUytKGiIqirK4oYw0ageVt29096SXUacuSow+WGzOEWU97MASPWKJJvCIZnWV+ecjaU
nC09irDq7oxW4IztfmEVBKmpElPUH4a2SUhJZNlmPB5As77zPV43wMGHB6aMGy3PVkIq
plBROhdNip5gK6+UO4rWvmj6Z6++1XLQ8vVELmtVFe+xFyaRt/4O/VyUJSgMCZ5yx+65
JCfxjlKaiOUA45Qku4L+ibT3L3REHygELqqQoZO/vAwaSTZsW/rjqqVEhNLoX8e3zfmb
vYiw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:user-agent:references:subject:from:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=DDEQ02yzr8n8hcmTafXqSwG3Bubd76x70Tan8xib4Sc=;
b=siLYjUFSWG4WnDSqWxkiwWtGn5iZRGlaGupnmqx+8H5C8KDI8z2+jP2CiFRsEEu8I+
drmHcmLUwKOsUqYlCDQWe56BIZx8Liy2fbzHzWlSaH5aQ0rjaIn3/q4Ov6UVKE8ZLjUA
N77mrkV6irBYJOIilxMI+BtzG2myNMoXjUKFNf70jJyxrwrzLXHpqHcLsc+AUwJ0P4f1
WPYMveIADopqciUAOHAFDUJPDSEbQB6ICNu61YwmxS2cLWszoL1RjbTBxBEtzTPPBkjO
D/UNpWfZad0gfkiULBl+M09NQPfVyylf/dATBhsyusl8xtlWCOvIM0aXBRmlR4shIWuw
J2hA==
X-Gm-Message-State: AO0yUKWXNpNMg+a/eqd0PxGUarTRdMjLYWpQFuTKr8QuOJkXxSnd3k9c
DsB1tWOqtrQx+qlWuf1vI9coaZLlHZ0=
X-Google-Smtp-Source: AK7set8SZ/FIfSQTHXVzVIezgR62NIRBgYOp5KsMiKo7BXIz2ULg8eMLXj7pFUYVGAP3j9XOTn6pog==
X-Received: by 2002:a05:6e02:1a4c:b0:314:1cff:75a8 with SMTP id
u12-20020a056e021a4c00b003141cff75a8mr2160254ilv.26.1676671389939;
Fri, 17 Feb 2023 14:03:09 -0800 (PST)
User-Agent: slrn/1.0.3 (Linux)
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <63eff99d.020a0220.bec00.1d43@mx.google.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
 by: Grant Edwards - Fri, 17 Feb 2023 22:03 UTC

On 2023-02-17, Mats Wichmann <mats@wichmann.us> wrote:

> And... this topic as a whole comes up over and over again, like
> everywhere.

That's an understatement.

I remember it getting rehashed over and over again in various USENET
groups 35 years ago when when the VAX 11/780 BSD machine on which I
read news exchanged postings with peers using a half-dozen dial-up
modems and UUCP.

One would have thought it would be a time-saver when David Goldberg
wrote "the paper" in 1991, and you could tell people to go away and
read this:

https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
https://www.itu.dk/~sestoft/bachelor/IEEE754_article.pdf

It didn't help.

Every fall, the groups were again full of a new crop of people who had
just discovered all sorts of bugs in the way <software/hardware>
implemented floating point, and pointing them to a nicely written
document that explained it never did any good.

--
Grant

Re: Precision Tail-off?

<k5aof8Fhs3qU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21736&group=comp.lang.python#21736

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Sat, 18 Feb 2023 14:37:44 +1300
Lines: 15
Message-ID: <k5aof8Fhs3qU1@mid.individual.net>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net rL3tfa/7ninP7klfH2CfFgnrJACJxFMRHzj/OaNbZuApT9g5FI
Cancel-Lock: sha1:am9k8Yt7gGayWMqmscIKlNoTuUo=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:91.0)
Gecko/20100101 Thunderbird/91.3.2
Content-Language: en-US
In-Reply-To: <mailman.1851.1676659340.20444.python-list@python.org>
 by: Greg Ewing - Sat, 18 Feb 2023 01:37 UTC

On 18/02/23 7:42 am, Richard Damon wrote:
> On 2/17/23 5:27 AM, Stephen Tucker wrote:
>> None of the digits in RootNZZZ's string should be different from the
>> corresponding digits in RootN.
>
> Only if the storage format was DECIMAL.

Note that using decimal wouldn't eliminate this particular problem,
since 1/3 isn't exactly representable in decimal either.

To avoid it you would need to use an algorithm that computes nth
roots directly rather than raising to the power 1/n.

--
Greg

Re: Precision Tail-off?

<mailman.1861.1676684688.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21737&group=comp.lang.python#21737

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ros...@gmail.com (Chris Angelico)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Sat, 18 Feb 2023 12:44:34 +1100
Lines: 28
Message-ID: <mailman.1861.1676684688.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de K/DWEAkgalUesdaPRD1gVw540el3/x+79i8Gr1T+lgoQ==
Return-Path: <rosuav@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=n3tFTZEN;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.016
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; '2023': 0.07; 'string':
0.07; 'damon': 0.09; 'problem?': 0.09; 'log': 0.12; 'that.': 0.15;
'chrisa': 0.16; 'decimal': 0.16; 'division,': 0.16;
'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16;
'greg': 0.16; 'operation.': 0.16; 'practice,': 0.16; 'somewhat':
0.16; 'wrote:': 0.16; 'feb': 0.17; 'to:addr:python-list': 0.20;
'problem,': 0.22; 'sat,': 0.22; 'anything': 0.25; "isn't": 0.27;
'am,': 0.31; 'raise': 0.31; 'concept': 0.32; 'else,': 0.32;
'python-list': 0.32; "wouldn't": 0.32; 'message-
id:@mail.gmail.com': 0.32; 'but': 0.32; 'particular': 0.33;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'really': 0.37; 'using': 0.37;
"it's": 0.37; 'received:209.85': 0.37; 'received:209': 0.39;
'received:209.85.208': 0.39; 'use': 0.39; 'should': 0.40;
'format': 0.62; 'richard': 0.64; 'exactly': 0.68; 'operations':
0.68; 'square': 0.69; 'addition': 0.71; 'eliminate': 0.84; 'exp':
0.84; 'roots': 0.84; 'storage': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=dNEsYHPyAjf0dPEt2WPpEkPySA7w38TsvOSq2TRp91w=;
b=n3tFTZENatm0i1cKp/HqewXNiZ3Vw10g8bo5rF2Mrnz8VG58zTn3bKqQYhysvp3pmW
RzrzPH8JCNDOeEr0tyEIhlrjDALcWfG9JycI+DEBNBsK+UIgNwNDiIYFlvcpkqAr7ltr
bYEhzKh40CAp5Ew8aKo3DGTMl3SjYaqjsQ7iZuhkgiCY+qhXHArCjCl1J7PVPZHEOLt0
YneUwTNfnirofK+/rkjRBDNkI39R84oTNugun92FZGOzxXcPLYzxBOywZhOuPXAYTBNU
zQps/ND7/uGEbTLFU6rWXfg73QE876jgevGh4w1h5jXjS2YAlQL0Ii/u9Z/9DyxOZWcy
REEQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=dNEsYHPyAjf0dPEt2WPpEkPySA7w38TsvOSq2TRp91w=;
b=Rw7hLgSdF33hxm6ICgCzbDCQl6ue9oYdnbAsorqQXd+zjIpbLZf8flfNezbmXPX5JW
ym9QyNq2Y1LHKWG+G0ff3JGO2KE5nCPlU2Cx7A4A9qUjKrC33wZvMBjFlP92lDF2Ac61
VK+9nARrZxeSh8VCbp8Rl96BT5BkJ7Yx0KhR2AjqVUSSboBgXzHzDWXb6VO95w+oqEvN
Q5n110roFHvhECphOLHtDdfRmjQ72onQLj8X4xz1YowWeUgxAvu/F+CB4PxrTGOueg9X
eSKAtu4dZmFjZ727AH+a7w2pINJmmTTxydZmnEGsMIrQCavguLL3B+Kx5Mjaz/3WyX5P
TKnw==
X-Gm-Message-State: AO0yUKUDhYREBOoR6loy00sUksS8IFdGsQOfmDMR52RDTrp9YxM1Ielh
CLifz5LTqnYxBr5PiFlz6iCJu74YeKk12H5mkot/cqiH
X-Google-Smtp-Source: AK7set9xIBx5RUNaBULDFbS/IwLfGklXfEvGd1dNsOTT9xPXTpZA2qBLPpC77U87/+dO58tazoiSCcbm2LrSvvA0ubE=
X-Received: by 2002:a17:907:77cf:b0:889:8f1a:a153 with SMTP id
kz15-20020a17090777cf00b008898f1aa153mr1540217ejc.15.1676684686166; Fri, 17
Feb 2023 17:44:46 -0800 (PST)
In-Reply-To: <k5aof8Fhs3qU1@mid.individual.net>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
 by: Chris Angelico - Sat, 18 Feb 2023 01:44 UTC

On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list
<python-list@python.org> wrote:
>
> On 18/02/23 7:42 am, Richard Damon wrote:
> > On 2/17/23 5:27 AM, Stephen Tucker wrote:
> >> None of the digits in RootNZZZ's string should be different from the
> >> corresponding digits in RootN.
> >
> > Only if the storage format was DECIMAL.
>
> Note that using decimal wouldn't eliminate this particular problem,
> since 1/3 isn't exactly representable in decimal either.
>
> To avoid it you would need to use an algorithm that computes nth
> roots directly rather than raising to the power 1/n.
>

It's somewhat curious that we don't really have that. We have many
other inverse operations - addition and subtraction (not just "negate
and add"), multiplication and division, log and exp - but we have
exponentiation without an arbitrary-root operation. For square roots,
that's not a problem, since we can precisely express the concept
"raise to the 0.5th power", but for anything else, we have to raise to
a fractional power that might be imprecise.

But maybe, in practice, this isn't even a problem?

ChrisA

Re: Precision Tail-off?

<873573vi6t.fsf@nightsong.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21738&group=comp.lang.python#21738

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: no.em...@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 18:08:42 -0800
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <873573vi6t.fsf@nightsong.com>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<mailman.1861.1676684688.20444.python-list@python.org>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader01.eternal-september.org; posting-host="1444d4befda959d7f92420a3e962da5c";
logging-data="3983502"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190mljvSjbdZ6xbwjiFZR60"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:1/qmm8m+3NX4yRSEB47nV889qns=
sha1:682LkwmeWWYEmCEM9cdTKmOCTkw=
 by: Paul Rubin - Sat, 18 Feb 2023 02:08 UTC

Chris Angelico <rosuav@gmail.com> writes:
> > To avoid it you would need to use an algorithm that computes nth
> > roots directly rather than raising to the power 1/n.
> It's somewhat curious that we don't really have that.

This *could* give an exact answer, but doesn't...

Python 3.9.2 (default, Feb 28 2021, 17:03:44) ...
>>> from fractions import *
>>> 125**Fraction("1/3")
4.999999999999999

I wouldn't want it to give an integer though: too much datatype
confusion.

There are some symbolic math packages that can compute in arbitrary
number fields, but that goes way beyond fulfilling the naive
expectations of people wanting cuberoot(125) to be exactly 5.

Re: Precision Tail-off?

<mailman.1863.1676688874.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21740&group=comp.lang.python#21740

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: torr...@gmail.com (Michael Torrie)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Fri, 17 Feb 2023 19:54:29 -0700
Lines: 15
Message-ID: <mailman.1863.1676688874.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
<63eff99d.020a0220.bec00.1d43@mx.google.com>
<74da1d78-5fbb-9c4d-50c9-a297870169d1@gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de yf9O0lSyYDIV9KX9o7DmhQODJqOTFObaP0KIxSdPa7yw==
Return-Path: <torriem@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=orPk6DRT;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.067
X-Spam-Evidence: '*H*': 0.87; '*S*': 0.00; 'formal': 0.07; 'fair,':
0.09; 'floating': 0.09; 'bugs': 0.16; 'think.': 0.16; 'vague':
0.16; 'wrote:': 0.16; 'grant': 0.17; 'message-id:@gmail.com':
0.18; 'to:addr:python-list': 0.20; 'written': 0.22; "i've": 0.22;
"what's": 0.22; "i'd": 0.24; 'idea': 0.24; 'programming': 0.25;
'header:User-Agent:1': 0.30; 'good.': 0.32; 'point,': 0.32; 'but':
0.32; 'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'people': 0.36; 'received:209.85':
0.37; 'received:192.168': 0.37; 'way': 0.38; 'means': 0.38;
'received:209': 0.39; 'people,': 0.40; 'full': 0.64; 'explained':
0.64; 'right': 0.68; 'article': 0.73; 'implemented': 0.76;
'discovered': 0.80; 'paper.': 0.84; 'pointing': 0.84; 'shows,':
0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:from:to:cc:subject:date:message-id:reply-to;
bh=DDZgqX/AGEmmrp4nK7NdmzrnMCOGcMNW8hC9UUEwZOg=;
b=orPk6DRTmlkh+A+ZtV+D7bYlJ3MOvj+spFVYfAEzGg2Xcnu33QP5ZVagmk+bPlAR+p
qET7xOkXHJfuZyP/BxHcd2APWlflkfzT+zkpIo6ljWXYtS2bO6aQMsC/M9ZVVobbv4Pe
+vSgZcuPY0sCOW+kTdk6DX4vjKKssJXjuC32SFrcUVwqqwYkKLow+d7/Mfptd4jbrAl0
5UvClpAKrqkCPPTH3lCoe478CNmGxXdaAIwEMKgPD1gn5OZI4sUwknLJavfnBaCJGcg5
vI77X+1T/hzfnzYjgsfr+3y9AjqNqnBXCRYDxvGYzaMkV0BCrzrEcdZwwaRN53jVSD8H
dR7g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-transfer-encoding:in-reply-to:from:references:to
:content-language:subject:user-agent:mime-version:date:message-id
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=DDZgqX/AGEmmrp4nK7NdmzrnMCOGcMNW8hC9UUEwZOg=;
b=RfgUF1WwKBAzMmrSeynYM2YF2XaIWGzPJurcCr7TuTFTs/Noj7Y1nIrpTe1bb72zyE
mpXsWbDsSZ0i0ds/eGvuMC3Zneg4/lnvALKMbYivXoGXzjL1j41aer39R/2wamjhuI8t
fS7EkEoM+mFqIeZQKuIMwp8MfDSb2YmXz8VA3FiebDGghNJCrRCzYHg3Qjd1yAvMxYZM
I2Akg0aHJunnJg2NtMaoGlbkHOnt1ujgMnhG4+CEtCcmZoUdmX5iUAXx8crIoFOsbBcK
8AfXADFCJ4gb+qs0jNYyezlQ0PljjWkerk8OYXSTGeM9NFLY8PuBpN0w+lCG1aafsFWE
Rlqw==
X-Gm-Message-State: AO0yUKWL5QoyzxvSKBY5aIULzLxM0+y6jxRi70XJN3UZTN4y/q2iQwsV
jlF32PHYCAvVV8NykhBOz0RWn0uF17g=
X-Google-Smtp-Source: AK7set91H2k3tmR7r9z5AZcHOi+dlPOOjM6ifCuTBKiysN/bmY4/rQi5LPh+W3xTX66H+bUZe/TGuA==
X-Received: by 2002:a17:90b:3b4f:b0:235:1fb7:393d with SMTP id
ot15-20020a17090b3b4f00b002351fb7393dmr5606825pjb.17.1676688871345;
Fri, 17 Feb 2023 18:54:31 -0800 (PST)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
Thunderbird/102.5.0
Content-Language: en-US
In-Reply-To: <63eff99d.020a0220.bec00.1d43@mx.google.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <74da1d78-5fbb-9c4d-50c9-a297870169d1@gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<155c30ab-3410-c1ba-2288-2021f135007e@wichmann.us>
<63eff99d.020a0220.bec00.1d43@mx.google.com>
 by: Michael Torrie - Sat, 18 Feb 2023 02:54 UTC

On 2/17/23 15:03, Grant Edwards wrote:
> Every fall, the groups were again full of a new crop of people who had
> just discovered all sorts of bugs in the way <software/hardware>
> implemented floating point, and pointing them to a nicely written
> document that explained it never did any good.

But to be fair, Goldberg's article is pretty obtuse and formal for most
people, even programmers. I don't need lots of formal proofs as he
shows. Just a summary is sufficient I'd think. Although I've been
programming for many years, I have no idea what he means with most of
the notation in that paper.

Although I have a vague notion of what's going on, as my last post
shows, I don't know any of the right terminology.

Re: Precision Tail-off?

<mailman.1864.1676692385.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21741&group=comp.lang.python#21741

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: oscar.j....@gmail.com (Oscar Benjamin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Sat, 18 Feb 2023 03:52:51 +0000
Lines: 74
Message-ID: <mailman.1864.1676692385.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de NikXF4VzpJTfQLRSkV6vwAEcdRh7+JEkblfbzmMWEjdQ==
Return-Path: <oscar.j.benjamin@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=SHXDOFlY;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.015
X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'approximate': 0.05;
'2023': 0.07; 'formal': 0.07; 'string': 0.07; 'angelico': 0.09;
'damon': 0.09; 'numerical': 0.09; 'numpy': 0.09; 'problem?': 0.09;
'log': 0.12; 'problem.': 0.15; 'that.': 0.15; '(1.0': 0.16;
'*all*': 0.16; 'calculations': 0.16; 'decimal': 0.16; 'division,':
0.16; 'dominate': 0.16; 'greg': 0.16; 'guarantees': 0.16;
'limiting': 0.16; 'operation.': 0.16; 'practice,': 0.16;
'precision.': 0.16; 'somehow.': 0.16; 'somewhat': 0.16; 'though:':
0.16; 'wrote:': 0.16; 'larger': 0.17; 'feb': 0.17; 'uses': 0.19;
'libraries': 0.19; 'to:addr:python-list': 0.20; 'problem,': 0.22;
'sat,': 0.22; "i'd": 0.24; 'anything': 0.25; "isn't": 0.27;
'local': 0.27; 'function': 0.27; 'old': 0.27; '>>>': 0.28;
'chris': 0.28; 'wrong': 0.28; 'error': 0.29; 'am,': 0.31; 'raise':
0.31; 'concept': 0.32; 'concerned': 0.32; 'else,': 0.32; 'python-
list': 0.32; "wouldn't": 0.32; 'message-id:@mail.gmail.com': 0.32;
'but': 0.32; 'there': 0.33; 'particular': 0.33; 'someone': 0.34;
'header:In-Reply-To:1': 0.34; 'received:google.com': 0.34;
'from:addr:gmail.com': 0.35; 'errors': 0.36; 'functions': 0.36;
'people': 0.36; 'those': 0.36; 'really': 0.37; 'using': 0.37;
"it's": 0.37; 'received:209.85': 0.37; 'hard': 0.37; 'this.':
0.37; 'though': 0.37; 'could': 0.38; 'received:209': 0.39; 'use':
0.39; 'evaluation': 0.39; 'still': 0.40; 'case.': 0.40; 'hand':
0.40; 'learn': 0.40; 'both': 0.40; 'something': 0.40; 'want':
0.40; 'should': 0.40; 'provide': 0.60; 'best': 0.61; 'format':
0.62; 'richard': 0.64; 'your': 0.64; 'well': 0.65; 'exactly':
0.68; 'operations': 0.68; 'square': 0.69; 'standards': 0.69;
'analysis': 0.69; 'offer': 0.71; 'addition': 0.71; 'global': 0.73;
'little': 0.73; 'deal': 0.73; 'accuracy': 0.74; 'accurate': 0.74;
'largest': 0.84; 'accuracy.': 0.84; 'compromise': 0.84;
'eliminate': 0.84; 'exp': 0.84; 'incorrect': 0.84; 'oscar': 0.84;
'roots': 0.84; 'storage': 0.95
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:from:to:cc:subject:date:message-id:reply-to;
bh=XdQmiaFWUwfqfdjLgEf6OygO4uloRngtTlv5NjbLH2A=;
b=SHXDOFlYBiQNsvuGjASsCgkvO35yN+7vJQldq4wqzhKTR0cf7ZksdKP7QEpE/gEgFF
kjnOxdZuwSAdKe4oOIrm0bpMnHfZUKjNhlDJWK3Yu+Q9Jyn+LNH+CKttE8VIcHGHmkV7
G63u4vtU4lH7P/aJZQcsbnuPLReHbdrpRkU/+LoJyBXxvm/Pdg/jOpdo81eA6MspBzpU
iVuTRxKzlLErBfZOPrmmBUeso+0yp8IjuaibxzAB+fw482mTCLRpVIaX7HACIwC/aOn+
G/VYPOstkqASFq+5jiB406ITBRL7cg67eI7pOKSrydVeouK694uyAHFQubkERmnnXCC3
tmeA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=to:subject:message-id:date:from:in-reply-to:references:mime-version
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=XdQmiaFWUwfqfdjLgEf6OygO4uloRngtTlv5NjbLH2A=;
b=b9pjPPD45idQWzuo7n9JKJ5YopTvuY74WPEV7R0RfBHsIHZCsQ8VWYi/nt8N7zOO8P
aWjbQI/2NOQOaTMTxMTNqW74GZvok3bevDkGTVGxuP8srbRROb55iXCjvfI0qSWzOI6C
ah8qg4bx/sZpoj1pkf7g0lG3GlzAPtjmN9jedY436nJ5TiVYoWlNL0CDriCIbz5AJk+G
XHR8dibEMw7b2VcHsRtOKEPYpfHyPzDDZQqIcZtyTQp6LEOSORShpeHvmTLzfcpczmuX
PBpYttnWgwTwq5IwhKYQWRgTQsbGRdHovYOkjOtQ5dcWDTHESpaHiC125eeej414nld5
R/Hg==
X-Gm-Message-State: AO0yUKVFO0c7e4x3ezv9fn0rrVAJPqXLr2z18oVcF35KkYrfaG/XxCE9
hbvoaaWLCbrfn6QQJK+nm/2VzXFEbth6eWPbBdfEaDfgiGo=
X-Google-Smtp-Source: AK7set+Ljzaef6toy3b2NIytznSX6M3lJnECUiOpvbGBqT62Nbo8cy3apR7KfQV4mZKynDtOB6tI/aF9RLi7OYVA2gI=
X-Received: by 2002:a05:6512:ac1:b0:4d5:ca32:6ed8 with SMTP id
n1-20020a0565120ac100b004d5ca326ed8mr3849265lfu.6.1676692383011; Fri, 17 Feb
2023 19:53:03 -0800 (PST)
In-Reply-To: <CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
 by: Oscar Benjamin - Sat, 18 Feb 2023 03:52 UTC

On Sat, 18 Feb 2023 at 01:47, Chris Angelico <rosuav@gmail.com> wrote:
>
> On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list
> <python-list@python.org> wrote:
> >
> > On 18/02/23 7:42 am, Richard Damon wrote:
> > > On 2/17/23 5:27 AM, Stephen Tucker wrote:
> > >> None of the digits in RootNZZZ's string should be different from the
> > >> corresponding digits in RootN.
> > >
> > > Only if the storage format was DECIMAL.
> >
> > Note that using decimal wouldn't eliminate this particular problem,
> > since 1/3 isn't exactly representable in decimal either.
> >
> > To avoid it you would need to use an algorithm that computes nth
> > roots directly rather than raising to the power 1/n.
> >
>
> It's somewhat curious that we don't really have that. We have many
> other inverse operations - addition and subtraction (not just "negate
> and add"), multiplication and division, log and exp - but we have
> exponentiation without an arbitrary-root operation. For square roots,
> that's not a problem, since we can precisely express the concept
> "raise to the 0.5th power", but for anything else, we have to raise to
> a fractional power that might be imprecise.

Various libraries can do this. Both SymPy and NumPy have cbrt for cube roots:

>>> np.cbrt(123456789000000000000000000000000000000000000000000000000000000.)
4.979338592181745e+20

SymPy can also evaluate any rational power either exactly or to any
desired accuracy. Under the hood SymPy uses mpmath for the approximate
numerical evaluation part of this and mpmath can also be used directly
with its cbrt and nthroot functions to do this working with any
desired precision.

> But maybe, in practice, this isn't even a problem?

I'd say it's a small problem. Few people would use such a feature but
it would be have a little usefulness for those people if it existed.
Libraries like mpmath and SymPy provide this and can offer a big step
up for those who are really concerned about exactness or accuracy
though so there are already options for those who care. These are a
lot slower though than working with plain old floats but on the other
hand offer vastly more than a math.cbrt function could offer to
someone who needs something more accurate than x**(1/3).

For those who are working with floats the compromise is clear: errors
can accumulate in calculations. Taking the OPs example to the extreme,
the largest result that does not overflow is:

>>> (123456789. * 10**300) ** (1.0 / 3.0)
4.979338592181679e+102

Only the last 3 digits are incorrect so the error is still small. It
is not hard to find other calculations where *all* the digits are
wrong though:

>>> math.cos(3)**2 + math.sin(3)**2 - 1
-1.1102230246251565e-16

So if you want to use floats then you need to learn to deal with this
as appropriate for your use case. IEEE standards do their best to make
results reproducible across machines as well as limiting avoidable
local errors so that global errors in larger operations are *less
likely* to dominate the result. Their guarantees are only local though
so as soon as you have more complicated calculations you need your own
error analysis somehow. IEEE guarantees are in that case also useful
for those who actually want to do a formal error analysis.

--
Oscar

Re: Precision Tail-off?

<mailman.1867.1676719032.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21744&group=comp.lang.python#21744

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: hjp-pyt...@hjp.at (Peter J. Holzer)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Sat, 18 Feb 2023 12:16:01 +0100
Lines: 60
Message-ID: <mailman.1867.1676719032.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
<20230218111601.vtlqaq5kpll3en2j@hjp.at>
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512;
protocol="application/pgp-signature"; boundary="hw33kqjnrmkayvck"
X-Trace: news.uni-berlin.de gs3/Xec5eSNrn4DuV1dRHAqlOx6WOYMEZicl9bM50bVw==
Return-Path: <hjp-python@hjp.at>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'content-
type:multipart/signed': 0.05; '2023': 0.07; 'angelico': 0.09;
'calculator': 0.09; 'content-type:application/pgp-signature':
0.09; 'filename:fname piece:asc': 0.09; 'filename:fname
piece:signature': 0.09; 'filename:fname:signature.asc': 0.09;
'numpy': 0.09; 'processor': 0.09; 'log': 0.12; 'that.': 0.15;
'"creative': 0.16; '__/': 0.16; 'arbitrary': 0.16; 'challenge!"':
0.16; 'division,': 0.16; 'from:addr:hjp-python': 0.16;
'from:addr:hjp.at': 0.16; 'from:name:peter j. holzer': 0.16;
'greg': 0.16; 'hjp@hjp.at': 0.16; 'holzer': 0.16; 'operation.':
0.16; 'reality.': 0.16; 'somewhat': 0.16; 'stross,': 0.16; 'url-
ip:212.17.106.137/32': 0.16; 'url-ip:212.17.106/24': 0.16; 'url-
ip:212.17/16': 0.16; 'url:hjp': 0.16; '|_|_)': 0.16; 'wrote:':
0.16; 'feb': 0.17; 'calls': 0.19; 'implement': 0.19; 'libraries':
0.19; 'to:addr:python-list': 0.20; 'problem,': 0.22; 'sat,': 0.22;
'anything': 0.25; 'library': 0.26; 'chris': 0.28; 'sense': 0.28;
'it,': 0.29; 'raise': 0.31; 'think': 0.32; "doesn't": 0.32;
'concept': 0.32; 'else,': 0.32; 'python-list': 0.32; 'but': 0.32;
'header:In-Reply-To:1': 0.34; 'yes,': 0.35; 'special': 0.37;
'really': 0.37; "it's": 0.37; 'this.': 0.37; 'use': 0.39; 'case.':
0.40; 'both': 0.40; 'inline': 0.61; 'received:212': 0.62; 'come':
0.62; 'button': 0.64; 'received:userid': 0.66; 'operations': 0.68;
'square': 0.69; 'url-ip:212/8': 0.69; 'addition': 0.71; 'exp':
0.84; 'oscar': 0.84; 'received:at': 0.84; 'roots': 0.84
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <20230218111601.vtlqaq5kpll3en2j@hjp.at>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
 by: Peter J. Holzer - Sat, 18 Feb 2023 11:16 UTC
Attachments: signature.asc (application/pgp-signature)

On 2023-02-18 03:52:51 +0000, Oscar Benjamin wrote:
> On Sat, 18 Feb 2023 at 01:47, Chris Angelico <rosuav@gmail.com> wrote:
> > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list
> > > To avoid it you would need to use an algorithm that computes nth
> > > roots directly rather than raising to the power 1/n.
> > >
> >
> > It's somewhat curious that we don't really have that. We have many
> > other inverse operations - addition and subtraction (not just "negate
> > and add"), multiplication and division, log and exp - but we have
> > exponentiation without an arbitrary-root operation. For square roots,
> > that's not a problem, since we can precisely express the concept
> > "raise to the 0.5th power", but for anything else, we have to raise to
> > a fractional power that might be imprecise.
>
> Various libraries can do this. Both SymPy and NumPy have cbrt for cube roots:

Yes, but that's a special case. Chris was talking about arbitrary
(integer) roots. My calculator has a button labelled [x√y], but my
processor doesn't have an equivalent operation. Come to think of it, it
doesn't even have a a y**x operation - just some simpler operations
which can be used to implement it. GCC doesn't inline pow(y, x) on
x86/64 - it just calls the library function.

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

Attachments: signature.asc (application/pgp-signature)
Re: Precision Tail-off?

<mailman.1868.1676724420.20444.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=21745&group=comp.lang.python#21745

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: oscar.j....@gmail.com (Oscar Benjamin)
Newsgroups: comp.lang.python
Subject: Re: Precision Tail-off?
Date: Sat, 18 Feb 2023 12:46:46 +0000
Lines: 72
Message-ID: <mailman.1868.1676724420.20444.python-list@python.org>
References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
<20230218111601.vtlqaq5kpll3en2j@hjp.at>
<CAHVvXxSe-2dfJ7XEwdiKPemhKhPLCfn5mh8ttizEoW_kvHKCiA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Trace: news.uni-berlin.de hn1xQIFjmszUe124noToOQd35KmOpuS9V3azGPHjnBrA==
Return-Path: <oscar.j.benjamin@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=njxmamuN;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.004
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'def': 0.04; '3.8': 0.05;
'math': 0.05; '2023': 0.07; 'angelico': 0.09; 'calculator': 0.09;
'floating': 0.09; 'module.': 0.09; 'numpy': 0.09; 'processor':
0.09; 'routine': 0.09; 'routines': 0.09; 'log': 0.12; 'that.':
0.15; 'arbitrary': 0.16; 'division,': 0.16; 'float,': 0.16;
'greg': 0.16; 'holzer': 0.16; 'int)': 0.16; 'integer': 0.16;
'operation.': 0.16; 'somewhat': 0.16; 'stdlib': 0.16; 'wrote:':
0.16; 'feb': 0.17; 'libraries': 0.19; 'to:addr:python-list': 0.20;
'problem,': 0.22; 'sat,': 0.22; 'anything': 0.25; 'examples':
0.25; 'function': 0.27; '>>>': 0.28; 'chris': 0.28; 'module':
0.31; 'raise': 0.31; "doesn't": 0.32; 'concept': 0.32; 'else,':
0.32; 'python-list': 0.32; 'message-id:@mail.gmail.com': 0.32;
'but': 0.32; 'there': 0.33; '100': 0.33; 'someone': 0.34;
"didn't": 0.34; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'yes,': 0.35; 'from:addr:gmail.com':
0.35; 'special': 0.37; 'really': 0.37; "it's": 0.37;
'received:209.85': 0.37; 'this.': 0.37; 'could': 0.38;
'received:209': 0.39; 'adding': 0.39; 'use': 0.39; 'case.': 0.40;
'define': 0.40; 'both': 0.40; 'reasonable': 0.62; 'skip:m 20':
0.63; 'button': 0.64; 'full': 0.64; 'skip:m 60': 0.64;
'operations': 0.68; 'accurately': 0.69; 'candidate': 0.69;
'square': 0.69; 'addition': 0.71; 'accurate': 0.74; 'float:':
0.74; 'skip:1 30': 0.82; 'exp': 0.84; 'leap': 0.84; 'oscar': 0.84;
'root:': 0.84; 'roots': 0.84; 'similarly': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:from:to:cc:subject:date
:message-id:reply-to;
bh=ajDr82RwRb+vYyiKP+NXB5EzWKFhFxrilpz6VOfztfM=;
b=njxmamuNW6+s5ivEqR0OV1nqCqKXREcjLzsVClPxF12TRC9y0OvTLP5J+OV4QNyF1Q
2LYzcnFacfbkmwsNsCwwf8JiWy3zNOLRfbb9ufXfmJFIYi9UUjIhX+JpIHC+vdlAvlbu
QcN3zJ7BWyOGqH5TC77A8AQxG5k4Ywq6pUVGSKXAI98vhaxGgbtSc3UwH6NTjVGpbLmi
gE6Mz4660b5vxBsD7oCrBvylC8qH0PIY1O2+NXg5CMa/P+Uu2uhIJLYJRxrn/OqLI3YM
7RruziyWhbjR+SKLNqQqerwDjtNLc28YKovMvj/LDuEGcUHR59WYfw7cbopLEEdzkkkv
82LA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=content-transfer-encoding:to:subject:message-id:date:from
:in-reply-to:references:mime-version:x-gm-message-state:from:to:cc
:subject:date:message-id:reply-to;
bh=ajDr82RwRb+vYyiKP+NXB5EzWKFhFxrilpz6VOfztfM=;
b=RJl/m4p2RuCzuCMv4BEMTqLCj3p8DRyfkCt6+jbwJ5MrOs8sjQNg3xoH5zu25D9q+m
ACuS4H97U/A1xKsJ3tmSYHBHVaQ+UY6a+IZMxHBMFwTeKX7jpAI+sV58TEWU1Pvyw+D8
fDvitg2bh9xrZKloKX8Ad96WmnybwatB7ekv90ZA9jMwyY8RcHz6YBmj9/nlWmbsjM6J
JmNhKsfN5sr/ho0CJg2OwH4bMR2I7aEP8CimtQUtwXg42FIna2k2qOB7CcH37NUefLS2
XhHqQGT+i4JBA62HhcZ137h53T9hfvjqEn1Deyrjb+vgXWbE0z8H/9YdTF+dBhTNCfqr
6gkw==
X-Gm-Message-State: AO0yUKUhOw4JVOrMnRxWTodflYp+gSIlw2+aT8NnVubngt3z+B3k6taD
P9k9kDQTH3RCqkePRAvtOdbbj6WDaoxAyS0TK9NiN3GlVmQ=
X-Google-Smtp-Source: AK7set++Mi/ziVfSnn9g10xDHEVI3qZabJVmcUf3ps4XhgID1RA0WyPMBsJpyw23l9x/n7pQ7B2p//tPyOTRQIN6QkA=
X-Received: by 2002:a05:6512:3c90:b0:4da:fa1f:bb20 with SMTP id
h16-20020a0565123c9000b004dafa1fbb20mr66717lfv.6.1676724418362; Sat, 18 Feb
2023 04:46:58 -0800 (PST)
In-Reply-To: <20230218111601.vtlqaq5kpll3en2j@hjp.at>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CAHVvXxSe-2dfJ7XEwdiKPemhKhPLCfn5mh8ttizEoW_kvHKCiA@mail.gmail.com>
X-Mailman-Original-References: <CAP=-cKVbQ6yj_QuwykJ_WifJfnSggowPDwYtnfvQ6FyF2w5b_g@mail.gmail.com>
<CAHVvXxTFqgurjCHHDpBRU_bGJ3fzXB=p7NY0tiGSJv5ng=fYkg@mail.gmail.com>
<mailman.1817.1676373454.20444.python-list@python.org>
<k57132F3e1U1@mid.individual.net>
<CAP=-cKVgqutG=GufPYA4+4Frzcma9g_A9t+hDNf1S39C53PyGg@mail.gmail.com>
<1373f7d0-a3b6-22c7-d409-8a4ee4208093@Damon-Family.org>
<mailman.1851.1676659340.20444.python-list@python.org>
<k5aof8Fhs3qU1@mid.individual.net>
<CAPTjJmpEPzFx0kRo3t3ym-pMWvFwUnXks+5JYqr=vygQrsSKgQ@mail.gmail.com>
<CAHVvXxSdr7Akn9Ofin=ia=ui67QdA=aAnVKKX=pW-fnGYYhpKQ@mail.gmail.com>
<20230218111601.vtlqaq5kpll3en2j@hjp.at>
 by: Oscar Benjamin - Sat, 18 Feb 2023 12:46 UTC

On Sat, 18 Feb 2023 at 11:19, Peter J. Holzer <hjp-python@hjp.at> wrote:
>
> On 2023-02-18 03:52:51 +0000, Oscar Benjamin wrote:
> > On Sat, 18 Feb 2023 at 01:47, Chris Angelico <rosuav@gmail.com> wrote:
> > > On Sat, 18 Feb 2023 at 12:41, Greg Ewing via Python-list
> > > > To avoid it you would need to use an algorithm that computes nth
> > > > roots directly rather than raising to the power 1/n.
> > > >
> > >
> > > It's somewhat curious that we don't really have that. We have many
> > > other inverse operations - addition and subtraction (not just "negate
> > > and add"), multiplication and division, log and exp - but we have
> > > exponentiation without an arbitrary-root operation. For square roots,
> > > that's not a problem, since we can precisely express the concept
> > > "raise to the 0.5th power", but for anything else, we have to raise to
> > > a fractional power that might be imprecise.
> >
> > Various libraries can do this. Both SymPy and NumPy have cbrt for cube roots:
>
> Yes, but that's a special case. Chris was talking about arbitrary
> (integer) roots. My calculator has a button labelled [x√y], but my
> processor doesn't have an equivalent operation.

All three of SymPy, mpmath and gmpy2 can do this as accurately as
desired for any integer root:

>>> n = 123456789000000000000000000000000000000000000000000000000000000

>>> sympy.root(n, 6)
1000000000*13717421**(1/6)*3**(1/3)
>>> sympy.root(n, 6).evalf(50)
22314431635.562095902499928269233656421704825692573

>>> mpmath.root(n, 6)
mpf('22314431635.562096')
>>> mpmath.mp.dps = 50
>>> mpmath.root(n, 6)
mpf('22314431635.562095902499928269233656421704825692572746')

>>> gmpy2.root(n, 6)
mpfr('22314431635.562096')
>>> gmpy2.get_context().precision = 100
>>> gmpy2.root(n, 6)
mpfr('22314431635.56209590249992826924',100)

There are also specific integer only root routines like
sympy.integer_nthroot or gmpy2.iroot.

>>> gmpy2.iroot(n, 6)
(mpz(22314431635), False)
>>> sympy.integer_nthroot(n, 6)
(22314431635, False)

Other libraries like the stdlib math module and numpy define some
specific examples like cbrt or isqrt but not a full root or iroot.
What is lacking is a plain 64-bit floating point routine like:

def root(x: float, n: int) -> float:
return x ** (1/n) # except more accurate than this

It could be a good candidate for numpy and/or the math module. I just
noticed from the docs that the math module has a new in 3.11 cbrt
function that I didn't know about which suggests that a root function
might also be considered a reasonable addition in future. Similarly
isqrt was new in 3.8 and it is not a big leap from there to see
someone adding iroot.

--
Oscar

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor