From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 26584 invoked from network); 22 Apr 2021 15:31:50 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 22 Apr 2021 15:31:50 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1619105510; b=q70cS6s8Yn+yfNyLWU1B35tLG4cGrvRVZAuvOojQq6w57m798aJ6DvWygF/GTcZG6A0XY8JlBQ SYFoPb4vVerj/BVvXJclDSOp/Abps5hCAKK/ChwUAWLAsN2QiQlTP+TQJqi3Neu9AvnZsEB18K c7rdpQuUZHH3l2kQPHgFfsrda7uctnGvBw0BWMdhlO7xxLYUgZefpqA0YncOYsSYn9m79m93kQ rXgi23qkyPwuo7ykGBR6I47+LvNOu0rnT3Nc37mVYKmaKR1SO3PeWswXux1t0COHVhrKqtGCOu YuOiTgfd3VzgBCdD2zrYLjdJwdBXF23ivdQUzgaWNZuutQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1619105510; bh=m4hCJNSOEGYdnebi880Rpstp5qhQSzHQQ1SzgVpLVlY=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature; b=UU4MQGAqfN16khlaFJNlDfjmg88BzBOB7V/I6bk4Zrm1BNmZraURseP91P/xVsqmgDhpO3jMg7 OuDaWhAm5myoRbjGVNR2kY7w6erxLWRk5unPF76unmbxSTsmK5oAVMiBjB1ILytR7p4gFA2hb1 6X3q6AHVup3+0UkCGJXmmgGLAQgjS0RRx6fggsnGfVZqGdLfFUiILbolCiiQE/n2BntDUq5VB1 Ry3mozZFzSKHd2dAD5bX1xbUga7FER2+pNl2wxIOLhUofKc9edKsS0v7tr9jIFhMAIwxJiIEDG 5yHXI0tKxZOA2oHLKdwmzlGAw31wTo2dnEGIRiCKi7DTLA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=bUNKUm0kmtB9S4tue5DJdU7OajOfjiqJ95U7hVJrpxI=; b=NE0lbq5TvTW6No+PoCsDFypTNZ 3a+6/PbCK6BCNf8mg65Ir9jcrp5CYJ6nElrib4PU2WFzm+MLFL7VQrbyimh9VOgmf55lgUHqrTHrv vHadlrcLNuwQkVBMPNRqfHoaG/rGKnZH5AXgrJrOz8zvTABaFth3M3z4ucQ18ZT3ijWwRBbj+OEKY eJxN/MFBTJ1FNzXI3LTxJyo1WaQ1ALT6GSySJ94N6OX12DwfOuZV5/ijA+geMNZE9fR/k5ylGRm+U 8MhdQsuGWoEoQfPX1gBLqmTT+RdhPKjvDiwIdaRkx636Q/zAAxY4FGud0CayJtsnNIKDqvnxD+J1O ujZV8kcA==; Received: from authenticated user by zero.zsh.org with local id 1lZbIy-0008XZ-PO; Thu, 22 Apr 2021 15:31:49 +0000 Authentication-Results: zsh.org; iprev=pass (joooj.vinc17.net) smtp.remote-ip=155.133.131.76; dmarc=none header.from=vinc17.net; arc=none Received: from joooj.vinc17.net ([155.133.131.76]:52874) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1lZbID-0008ID-Ni; Thu, 22 Apr 2021 15:31:02 +0000 Received: from smtp-zira.vinc17.net (lfbn-tou-1-1431-42.w90-89.abo.wanadoo.fr [90.89.233.42]) by joooj.vinc17.net (Postfix) with ESMTPSA id 4E4082D4; Thu, 22 Apr 2021 17:31:01 +0200 (CEST) Received: by zira.vinc17.org (Postfix, from userid 1000) id EA566C23154; Thu, 22 Apr 2021 17:31:00 +0200 (CEST) Date: Thu, 22 Apr 2021 17:31:00 +0200 From: Vincent Lefevre To: zsh-workers@zsh.org Cc: Bart Schaefer Subject: Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions) Message-ID: <20210422153100.GD154089@zira.vinc17.org> Mail-Followup-To: zsh-workers@zsh.org, Bart Schaefer References: <7FD930F4-37CD-402B-9A06-893818856199@dana.is> <20210411175726.hxnm33mxoska2tsm@chazelas.org> <20210411193154.zkekzvb4o6xmriwo@chazelas.org> <20210413071742.tisslgg5fdqbageg@chazelas.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210413071742.tisslgg5fdqbageg@chazelas.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/2.0.6+158 (8162c129) vl-132933 (2021-04-22) X-Seq: 48656 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote: > 2021-04-12 13:41:58 -0700, Bart Schaefer: > > On Sun, Apr 11, 2021 at 12:32 PM Stephane Chazelas > > wrote: > > > > > > $ zsh --emulate sh -c 'inf=42; echo $((inf))' > > > Inf > > > > > > (POSIX requires 42 there). > > > > Is that because "Inf" is case-sensitive, or because POSIX requires > > evaluating the variable? E.g. what does > > That was because "inf" in an arithmetic expression, where inf is > the name of a variable whose contents is an integer constant > (decimal, octal or hex) is meant to represent the corresponding > integer number (and an empty or unset variable is meant to yield > 0).. I think that it would have been better if zsh chose something that does not correspond to the name of a variable, e.g. @Inf@ and @NaN@ (this is what MPFR does, so that it cannot be confused with numbers in large bases, where letters are used as digits). > I think it would be worth documenting that nan and inf are > recognised in arithmetic expressions (and warn against using > variables with the same name). IMHO, zsh should also output a warning when such variables are used. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)