Bill Allombert on Thu, 22 Feb 2024 11:44:02 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Numerical instability in extracting base B digits of the fractional part of real
|
- To: pari-dev@pari.math.u-bordeaux.fr
- Subject: Re: Numerical instability in extracting base B digits of the fractional part of real
- From: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
- Date: Thu, 22 Feb 2024 11:43:56 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1708598640; c=relaxed/relaxed; bh=SQc1R1rIbxx4I3B6ohrqHXi/5FUKNuaPq4d1TRYmjmc=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:Mail-Followup-To: References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; b=iVAmZK6yMBBbb6HTd8jQ7MrYecWsVXkURuGQ4Vmrb1g5zGXN0rjwUCxWEDM2kZB3jfX+Qj8nBxJ6nwYvHZDaE5uyN9C2XjHigRqedoJe2tCvWZOpgo0xHMxKH0h15253kpeOp+znjBhHCKCUZ7vjSfi5xXIU8r+CzA8mHaMQggpTubzq1o9k4oIpYs8gl1qTJG2YqT22PK+izTENMEh7jaFunksUp6GgcXU97vOjVwQUGPFUJjzvZEDBFuEmvMVYWjO9gPA1bkMv5vBYre3bGdOakxU71VqB06BXcXCnHLHkzFvDd4wNuvlHi4UgeCsIVedS46AhbF2OHdF5LP5VduC2k1tCrHFoUoGhH1x+TYg0PzgWMdORMcQPuFuqULduA2o82v3mAhw+DpqSJSL6wSJL5zsn+RHKaaMpb2fkRKFCXLEJ6Xc0i+zXjgszljA3iTAuezY6jcEkt7wmcaEATy8pF553fgIvEjNbuB1FEc71yQ6PJt4oSo5c6XGsiagGXC+sE1OVhPBrpFlDADD1JVJm/H63TtI02lM71GwZFYTwW9AMjMqYcvLFOB62zi1izncwKX92ENQMjdVbldXaIMh4hM/LbaNPoQxSEbDrBs/oJA0H4JbodymXnREFl41HeJB5rmr7mMxep7M878D+YzxEBt7boNGcWzuXef61BGg=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1708598640; cv=none; b=LGcldkYDjoTtLq7ByenWotHVU3pur5ac7aA8FCUYjkSUcbxoZ+cLxxz9XCQJ3ymlxVMZfN0GWaqunoQofgZ8LJs3GGAT99Rx9gkSU9t3HEigsaF37w5xeqYJmDdqn/7pLZUJ5L19zor9GMlXOruYtvUmYwfweINuuI/1KMWi+XcdUwvr9uomxlInO+Rz2cKtMUhBk7K0u2Vq/3994CNxFfTQ/lb3UfUCu5qv7/LQUaZnOLJr93jycmXKFyeRR0ieuXHlzu5rSH2Z5udvBABUDY/ChkW9LF3FheKXmrCgsgwfscpxdCnxvNOAhfoOVt/khVXZtH2ty+JvzWl8yKimd+ZOXSyh1yrwzZHZFd3oG6pYDfkIbcVWuyK5H53E9/sEkI/u1BcRsT3kE/PO7FoSAk8MRzmmMMXh7TvtBa6pDKnC4lL50JM4kRfE7F1L7rohVa2iReAqy9w9rUTPv6G9/q0znXSvGVWHBDCej2Qo+JgsdWMyK7IQWHm+oiKIiQotanpso2vUiOCYLcmpKxwCisYnNJMaFnaGjvtub63e6JHNKEwpSM+GLTE07pY/p146b2A+OaAw/2P5aVLDELFIzZnT8cWILD6HyIM4JV0U4pOCHmdsFCZlKDdl403NV+Ln8pUD83dGHhM8DaDXIIOLJPOKajzrXqt5zcmDp3bVgIA=
- Authentication-results: smail; dmarc=none header.from=math.u-bordeaux.fr
- Authentication-results: smail; arc=none
- Delivery-date: Thu, 22 Feb 2024 11:44:02 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1708598640; bh=SQc1R1rIbxx4I3B6ohrqHXi/5FUKNuaPq4d1TRYmjmc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=ioF5Mw54jTOR1D6tbDHMT9EAuYQjFU13IRsAaYci7UaB6inLRVo/Ckka1sKEIfPvt 7qVeCE3gL6v94tfXD0VLHG2gD1j/ZEwEnqCSrhbxQWzPTz/EY+xq5nNBynY+k8B/YI BSgm6Glqn5w02lfw9qNlSqNKUWl2avQ/U2HGiNOk66+tEm6982qjIQWaP52iXT8V0Q LyfaHn3+bLusSiKCaNsXKS7rxMNZBAxC4OttWdNQFcbtbg7ndQhsy6gCZXDoN2SJcM IVk3s5WF6cPWcZZRlL2C+R/NEdnvczmJITq70ztnMwq34A3iS/nIGgC7devVs/IXQv lA4YwQiTi8yJZwvt4KpkW/lujkMvQZkxIhhEkmdtp0zVRzvITxaLxeO8Eap8Q5gWHo /3V/yFqasJ/K9y79zZPZ8f4d5RYjFmzSCIjagvsb96uvlkeYS7hjLU+rD2MrZzk5hS ktGHBql26A+bfSJayn8276GPkbCDDKgYOpsEZWsyLo7+8kmH75fmTtv6AuRG9XY+SR IVgAqMQycfjDaKxNx+q0SP7GjNgqt6vGDGSI8xlQ+gUSKeEE18uvskYKcVIWZIBPsh BP8Gc/VyPbq7eYJU7r5VvPR/Ncib6Jc6TjEfMYoOrvI78a2Phgs20E2GIUGB/hdANL 4VU+s9sjp+U4jBLz5bEC7+n4=
- In-reply-to: <CAGUWgD-7uEpNhrnvzyxhD1DpOoDwGHoJcTJ53+Es32oSwkO5yQ@mail.gmail.com>
- Mail-followup-to: pari-dev@pari.math.u-bordeaux.fr
- References: <CAGUWgD9jh04yWKo8gnd=oT8sxt---hQiq65tGc0cM6Mxnk3wdw@mail.gmail.com> <Zc9EKwc0OJ8gF/b6@seventeen> <CAGUWgD9R94BGzucES2RMAkakRr8z0yygJrAm-ontN-uWe0Pn+g@mail.gmail.com> <Zc+InbDj44/YHxrK@seventeen> <CAGUWgD8tZP-8T1jStNjMCAqG59QNRfNAJaMCNQYq+q_BV42_hA@mail.gmail.com> <CAGUWgD-7uEpNhrnvzyxhD1DpOoDwGHoJcTJ53+Es32oSwkO5yQ@mail.gmail.com>
On Thu, Feb 22, 2024 at 09:13:31AM +0200, Georgi Guninski wrote:
> Some observations:
> 1. With precision 100 I get correct result.
Sure, this is due to base 2 to base 10 conversion.
33/100 cannot be represented exactly in base 2,
so depending of the precision it will be represented either as
33/100 + epsilon
or 33/100 - epsilon
in the first case, you will get 0,3,3,0,0,0,0,...
and in the second you will get 0,3,2,9,9,9,9,9
But you can obtain the correct result by using 33/100 instead of .33
Cheers,
Bill.