Subject: Re: floating point negative zero in awk
To: Jason Thorpe <thorpej@shagadelic.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-userlevel
Date: 08/27/2007 21:53:44
On Mon, 27 Aug 2007, Jason Thorpe wrote:
> > $ echo | awk '{ print -1 * 0 }'
> > -0
> >
> > Would it be OK if I commit the following patch, which ensures that
> > arithmetic in awk will never yield a negative zero?
>
> No objection from me. Does POSIX have anything to say about this? What does
> GNU AWK do?
glacier:/opt/home/reed/book/bsdwiki$ echo | awk '{ print -1 * 0 }'
-0
glacier:/opt/home/reed/book/bsdwiki$ echo | gawk '{ print -1 * 0 }'
0
glacier:/opt/home/reed/book/bsdwiki$ pkg_info -Fe `which gawk`
gawk-3.1.5nb1