Re: msys 1.0.13 gawk problem

Ralf Fassel <[email protected]>
Newsgroups gmane.comp.gnu.mingw.msys
Organization Akustik Technologie Goettingen
Message-ID <[email protected]>
* Charles Wilson
| msys:
| $ uname -s -r
| MINGW32_NT-6.0 1.0.13(0.47/3/2)
| $ gawk --version
| GNU Awk 3.1.7
| $ echo "-1 2" | gawk '{printf "%f %f\n", $1, $2}'
| -1.000000 2.000000

This is what I'd expect.

| I really wouldn't expect gawk's %f printf to act any differently
| that C's:
| 
| #include <stdio.h>
| int main(int argc, char *argv[])
| {
| 	double d1 = -1;
| 	double d2 = 2;
| 	printf ("%f %f\n", d1, d2);
| }
| 
| 
| $ gcc -o bob bob.c
| $ ./bob
| -1.000000 2.000000

In fact, it does not:

    $ gawk '{printf "%g %g\n", -1, 2}'

    1 -2

    -1 2

    1 -2

    -1 2

Note the alternating sign...

    $ cat x.c
    #include <stdio.h>
    int main(int argc, char *argv[])
    {
	    double d1 = -1;
	    double d2 = 2;
	    printf ("%f %f\n", d1, d2);
	    printf ("%f %f\n", d1, d2);
	    printf ("%f %f\n", d1, d2);
	    printf ("%f %f\n", d1, d2);
    }

    $ gcc -o x x.c

    $ ./x
    1.000000 -2.000000
    -1.000000 2.000000
    1.000000 -2.000000
    -1.000000 2.000000

I.e. the C binary also gets it wrong.  Seems like this has nothing to
do with gawk.

If I run the very same binary in the 1.0.12 environment, it is ok:
    $ ./x
    -1.000000 2.000000
    -1.000000 2.000000

msysinfo for 1.0.13:
    $ msysinfo
    msysinfo-1.3: Send this to the MSYS support list:

    MSYS 1.0.13(0.47/3/2) 2010-01-15 19:54 i686 unknown; targ=MINGW32
    GNU bash, version 3.1.17(1)-release (i686-pc-msys); ENV=.profile
    GNU Make 3.81This program built for i686-pc-msys; MAKE_MODE=unix
    gcc (GCC) 3.4.4 (msys special); targ=MINGW32
    GNU ld (GNU Binutils) 2.19.51.20090704
     2010-01-15 19:56:40.000000000 +0000 /bin/msys-1.0.dll
     2008-03-25 23:51:00.000000000 +0000 /bin/make.exe
     2010-01-16 20:38:39.000000000 +0000 /bin/gcc.exe
    2 2010-01-16 21:17:47.000000000 +0000 /bin/ld.exe
    HOME=/c/home/ralf
    Sysname=MINGW32_NT-5.1  OSTYPE=msys  TERM=cygwin
    PATH=/bin
    $ ls -tx /c/home/ralf/tmp
    x.exe*  x.c

Will try to recompile the MSYS runtime...

R'

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.