bug-gnu-utils
[Top][All Lists]
Advanced

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

should FIELDWIDTHS accept floating point numbers?


From: Jim Meyering
Subject: should FIELDWIDTHS accept floating point numbers?
Date: Thu, 29 Apr 2004 16:22:01 +0200

Hi,

Looking at how to solve the strtod problem,
I noticed that when the FIELDWIDTHS variable is set,
the values are interpreted via gawk_strtod.
Is that deliberate?

I would have expected this to elicit a diagnostic:

     BEGIN  { FIELDWIDTHS = "1.2 9.9" }

There's a similar question about whether the file descriptor number
in e.g. "/dev/fd/1.6" should be parsed as a floating point number.

In this example, the descriptor number is converted to `1' (stdout):

  $ gawk 'BEGIN { print "phoey!" > "/dev/fd/1.999999999999999" }' > /dev/null

But append one more `9' and it is treated like "/dev/fd/2" (stderr):

  $ gawk 'BEGIN { print "phoey!" > "/dev/fd/1.9999999999999999" }' > /dev/null
  phoey!

What do you think about using strtoul instead, in those two cases?

Jim




reply via email to

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