help-gawk
[Top][All Lists]
Advanced

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

Re: Make division by zero legal


From: Andrew J. Schorr
Subject: Re: Make division by zero legal
Date: Tue, 3 Aug 2021 10:23:58 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

On Mon, Aug 02, 2021 at 09:04:52PM -0500, Neil R. Ormos wrote:
> Andrew J. Schorr wrote:
> > Nethox wrote:
> 
> >> [...]
> >> $ gawk -M 'BEGIN { print 1/0; print "workaround" }'
> >> +inf
> >> workaround
> 
> > I can't speak to why gawk currently crashes on
> > division by zero; it does seem odd that -M
> > behaves differently.
> 
> Notwithstanding mawk and gawk -M, other awks do
> treat division by zero as a fatal error and, like
> gawk, have for years.
> 
> I rely on that behavior.  Perhaps others do, also.
> 
> Inasmuch as there are several trivial workarounds
> available to the OP, I hope his or her proposed
> change will not be incorporated into gawk as
> default behavior.

This is basically a bug in the -M implementation. It needs
to be brought in line with the regular non-M behavior to
throw a fatal division by zero error. So the "workaround"
is not a good long-term plan.

Regards,
Andy



reply via email to

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