Subject: Re: floating point negative zero in awk
To: Jeremy C. Reed <reed@reedmedia.net>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-userlevel
Date: 08/27/2007 21:27:18
On Aug 27, 2007, at 7:53 PM, Jeremy C. Reed wrote:

> 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

Then your patch is fine with me.

>
>
> glacier:/opt/home/reed/book/bsdwiki$ pkg_info -Fe `which gawk`
> gawk-3.1.5nb1

-- thorpej