[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Gawk - problem with hexadecimal numbers
From: |
Pierrik . Vuilleumier |
Subject: |
Gawk - problem with hexadecimal numbers |
Date: |
Tue, 14 Feb 2006 15:28:15 +0100 |
Dear GNU,
I have some problems with the strtonum() gawk function with hexadecimal
numbers. After a number of trials, the problem narrows down to the presence
of the digit "e" in the number. The small example below shows that it is not
recognised while the other digits work OK. The same happens with a longer
hex number when it contains a "e".
Could there be some confusion with the "e" marking the exponent in floating
numbers ?
Thank's for your help.
Regards,
Pierrik Vuilleumier
The problem =======================
echo 0xf | awk '{print strtonum($1)}'
15
echo 0xe | awk '{print strtonum($1)}'
0
The gawk version =========================
/usr/bin> gawk --version
GNU Awk 3.1.4
Copyright (C) 1989, 1991-2003 Free Software Foundation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/usr/bin> ldd -r gawk
linux-gate.so.1 => (0xffffe000)
libdl.so.2 => /lib/libdl.so.2 (0x40030000)
libm.so.6 => /lib/tls/libm.so.6 (0x40035000)
libc.so.6 => /lib/tls/libc.so.6 (0x40058000)
/lib/ld-linux.so.3 => /lib/ld-linux.so.2 (0x40000000)
The SusE 9.3 platform =================================
/usr/bin> uname -a
Linux proba-ips 2.6.8-24.19-smp #1 SMP Tue Nov 29 14:32:45 UTC 2005 i686 i686
i386 GNU/Linux
- Gawk - problem with hexadecimal numbers,
Pierrik . Vuilleumier <=