I have reported this issue a few days ago to the gawk maintainer Arnold Robbins where it is described in detail:
https://lists.gnu.org/archive/html/bug-gawk/2026-05/msg00014.html
bottom line is that depending on system/OS/ibrary used/linked exp() underflow might or might not trigger 'out of range' warning. this is bad isince it get's massively in the way when some script uses a substantial loop where the underflow just is basically fine (e.g. exp(-900) → 0 within floating point precission) but hundreds of warnings might flood the screen, forcing to use categorical 2> /dev/null redirection to silence those warnings (which in turn also will hide all true errors and is therefore not a real solution).
Arnold has confirmed that this will be fixed in future gawk like so:
--------------------------------------
diff --git a/builtin.c b/builtin.c
index f33525d5..a797d7fc 100644
--- a/builtin.c
+++ b/builtin.c
@@ -207,7 +207,7 @@ do_exp(int nargs)
DEREF(tmp);
errno = 0;
res = exp(d);
- if (errno == ERANGE)
+ if (errno == ERANGE && res != 0.0)
warning(_("exp: argument %g is out of range"), d);
return make_number((AWKNUM) res);
}
--------------------------------------
I believe the corresponding place in the nawk code is here:
|
case FEXP: |
|
errno = 0; |
|
u = errcheck(exp(getfval(x)), "exp"); |
and my request/suggestion would be to fix it accordingly: issue ERANGE warning for overflow, but not underflow, of exp() (provided this is considered acceptable to do for the one true awk at all ...)
I have reported this issue a few days ago to the gawk maintainer Arnold Robbins where it is described in detail:
https://lists.gnu.org/archive/html/bug-gawk/2026-05/msg00014.html
bottom line is that depending on system/OS/ibrary used/linked exp() underflow might or might not trigger 'out of range' warning. this is bad isince it get's massively in the way when some script uses a substantial loop where the underflow just is basically fine (e.g. exp(-900) → 0 within floating point precission) but hundreds of warnings might flood the screen, forcing to use categorical
2> /dev/nullredirection to silence those warnings (which in turn also will hide all true errors and is therefore not a real solution).Arnold has confirmed that this will be fixed in future gawk like so:
I believe the corresponding place in the nawk code is here:
awk/run.c
Lines 2085 to 2087 in 5739fd7
and my request/suggestion would be to fix it accordingly: issue ERANGE warning for overflow, but not underflow, of exp() (provided this is considered acceptable to do for the one true awk at all ...)