comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Question about best practices with numerical functions
Date: Mon, 6 Jul 2020 21:52:09 -0700 (PDT)	[thread overview]
Message-ID: <612a5956-c885-4240-9341-09dbfd49f44eo@googlegroups.com> (raw)
In-Reply-To: <re0888$13vl$1@gioia.aioe.org>

Also in my case the loss of precision is not due to approximation introduced by  operations, but to a loss of convergence because (maybe) for that input value the convergence is too slow and the bound on the number of iterations is not large enough.

On Tuesday, July 7, 2020 at 12:23:09 AM UTC+2, Dmitry A. Kazakov wrote:
> On 06/07/2020 19:02, Shark8 wrote:
> 
> > 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 for 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 about 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 dealing with floating-point, where the particular error simply couldn't have happened with fixed-point.
> 
> Rounding error is bounded in both cases. Fixed-point has same error 
> regardless the values involved in the operations. Floating-point has 
> error depending on the values.
> 
> I would say that floating-point error would be roughly same for 
> addition, subtraction and multiplication, provided fixed-point does not 
> overflow. It will be hugely better for division.
> 
> Using fixed-point arithmetic has only sense for a few marginal cases of 
> rounding.
> 
> Furthermore converting many algorithms to fixed-point might turn quite 
> non-trivial as you will have to ensure absence of overflows and 
> underflows. Where floating-point computation just would lose some 
> precision, fixed-point will catastrophically fail.
> 
> -- 
> Regards,
> Dmitry A. Kazakov
> http://www.dmitry-kazakov.de

      reply	other threads:[~2020-07-07  4:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-04  5:30 Question about best practices with numerical functions mockturtle
2020-07-04  7:50 ` Dmitry A. Kazakov
2020-07-04 10:45 ` Nasser M. Abbasi
2020-07-06 17:02 ` Shark8
2020-07-06 22:23   ` Dmitry A. Kazakov
2020-07-07  4:52     ` mockturtle [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox