From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on ip-172-31-74-118.ec2.internal X-Spam-Level: * X-Spam-Status: No, score=1.8 required=3.0 tests=BAYES_50,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:a0c:be08:: with SMTP id k8mr48612115qvg.123.1594054960220; Mon, 06 Jul 2020 10:02:40 -0700 (PDT) X-Received: by 2002:aca:c587:: with SMTP id v129mr195486oif.0.1594054959955; Mon, 06 Jul 2020 10:02:39 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 6 Jul 2020 10:02:39 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: google-groups.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Question about best practices with numerical functions From: Shark8 Injection-Date: Mon, 06 Jul 2020 17:02:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:59370 List-Id: On Friday, July 3, 2020 at 11:30:53 PM UTC-6, mockturtle wrote: >=20 > [5] ???=20 >=20 > Any suggestions? One way to do this would be to use fixed-point types: (1) Convert your input to the fixed-point that has a "good enough" delta fo= r the precision you want. (2) Run the algorithm. (3) Convert back to your normal value-type. This assumes you're using floating-point or integers, but one nice thing ab= out fixed-point is that it has a bounded error when dealing with operations= , unlike floating-point. -- I remember some years ago seeing a bug report d= ealing with floating-point, where the particular error simply couldn't have= happened with fixed-point.