bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Error Gawk Manual FP Precision


From: Jannick
Subject: Re: [bug-gawk] Error Gawk Manual FP Precision
Date: Tue, 21 Aug 2018 07:55:51 +0200

On Mon, 20 Aug 2018 15:59:53 -0400, Andrew J. Schorr wrote:
> On Mon, Aug 20, 2018 at 05:49:27PM +0200, Jannick wrote:
> > The following simple version of the function within_delta should work:
> >
> > function within_delta(a, b, delta)
> > {
> >     return abs(a - b) < abs(delta) # note the '<'-sign }
> 
> Yes, but isn't delta known to be positive?
> In other words, why isn't
>    abs(a-b) < delta
> an adequate test?

I agree that in this example delta can be assumed to be positive to keep
things as simple as possible.
However, a generic version of the function should check if delta is positive
or - if abs(delta) is used - is non-zero.
 
> Regards,
> Andy

Regards,
J.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]