From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 62649235C7 for ; Mon, 5 Feb 2024 03:11:25 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1707099085; b=E4kjk1CH0dBUN54hYnhO9vkCu3nJlwWNXo3ed3rYOUsZKfCcFwCIBasAp0TAUycvzrmZbNHKBo BT0MbRXhqhhu8NYUb7EkiUSShYmN+bjThLKe1pwZPDa4MOo+wOe0SIOqmxYe2unZR5kT0aAf25 v90MkK8YJjXxs0al9j1LVJAtpugwMyRtrk3RtdxyzPWIX+wA//R8xibQ2xZxWeQjbgobJV1j1Q HdeOsvUhJZgnYziz8gSL50xb++mTeLNYdVc6mGkAJ2uT+LOTAFW38ifGx+1ysgQS9qmdfKBKUb xiYGC3ZjRfnAef0Brola3HPPRsSwCYVDNpG1NAwRglZvRw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wr1-f50.google.com) smtp.remote-ip=209.85.221.50; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1707099085; bh=wj+CIBx5vLTFQof9FQ6uUH/yMW/jPLWUV/IP9E69fUw=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=M6SdB5hIgS7UCpHd2EfaI0nUowfKwlvc5vXJ40UkMkrQgP0/6z9li4vnxGOeGr9/H1Z8GS7dzx 0TIX2YUIWxSR94wyN/3Zm+BOAOf5DwoO9sivTLept2IMKIpySjpxa4yQCasjJDIri0Da3C2rV5 PUarS4pVIpl+e8f/sq0wTP8JVD7eGKVsISZXyWaqdlI3KldR6xOJSPCgFvB/pcjYgu8q/RF02b OWlhx/b7Zxw2ph3jsIrS1sBOA8Rv7jIR24RorKFuPojoq+YUbC+BwY3AvfTOLNahyfKAI4qplk oHH/6ZoOSv5TlxkoJLo8XNWmUV8Sst585Tdwb+VoScLhXA==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=33IaLP41FviLKDiGd3KDLuVeruBIUbFAuc4864VHe2M=; b=sgLUGhEulFBLzKC9pNfhy1HJSX Kcvzv3AgKshXIOYLyFGhIPo0BlHt9GFwtE9AXycBVTQSUiM7KRJOLNQoBw+961ThH/qEwZNVbsF/v 82Rwttfgh+SQg8W9Uh1evmR6x/kPxR78M+IQHnUJPKSToAQnHuIwO4lS36rSTeG3wQfmW+4VPLpDu dAcMRMw1fN8HQqrvZqa2Qa7hjXQ3NdNZad72HHiVZIvbtH4VHWyYJFXP2QWn4KUeujXJRrf35cQGS 5otvyeRLPij2q6vQ5mjAdUIc1e43jme4IzYRIB9ZjbKjb6k18Y5ieWHRaeGAdNq9ArSjyfBfnNaJB k7mlS5rQ==; Received: by zero.zsh.org with local id 1rWoSD-000H2n-8E; Mon, 05 Feb 2024 02:11:25 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wr1-f50.google.com) smtp.remote-ip=209.85.221.50; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-wr1-f50.google.com ([209.85.221.50]:52467) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rWoRW-000GNk-ND; Mon, 05 Feb 2024 02:10:43 +0000 Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-33b18099411so453199f8f.0 for ; Sun, 04 Feb 2024 18:10:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1707099042; x=1707703842; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=33IaLP41FviLKDiGd3KDLuVeruBIUbFAuc4864VHe2M=; b=bPbLmtwq15XB5IxXIO15brCa3aBkpZspswlkA54nKellyCBr5eLpWkpQG0e42SzfX4 jQMGXKZfWpzX8wUvXytEd9KFqO2WGoK7QKOOwlqRno63ifnjymtgM/7Hb/2j0gakHlxh mVjfF+YEnJ+qJLB3O1Q6X+5aUGtNuND6jDxAHL8Zvhi1fYb3AOh2jOYhicX9Mb3vc3ol RWv0XxTyYA/DhSx89MCPZ09Hr57G+72Hsr1ZOxL3+LYWj+fL0JlBpu9k3FtsUFxGH9jp rAHgytCxjULw/4qPjnjO6Qm4RQObv0N8hqoh9dIBTowj2u8NPygP9exkc19GnTrDXTRO 2+iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707099042; x=1707703842; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=33IaLP41FviLKDiGd3KDLuVeruBIUbFAuc4864VHe2M=; b=fg7bHWkhHZFof7bbFJyJqC/6CwxVugYG8jfYkmWmahZFypij/9ldVWA1a64E7BMosz 2AcVsQ9GVy0UAZSD1uOF5g3DJDml3QR8RkleSkK8MJcqM/lBVfWWa2Zdwx6XNzoEY7np LGjlu+uxDYgi13tpTffXTRGL2tfCVGBhn+uKoEhMv+UZzypw/CEVmwRAmgUZQXIO+7/U LEzhsfdSQgUIIOHxzTAGo8vsEFvJZif2f4uXzBCQyBOFB/Rpl1ShYU1TX2I3in/DobHP GN1y++bkVnyk48QgQ+Liq0Qg27mXBjzgfJt1rEqlLNCWsf3R0+wzeaqOA56kovyZlRVs pljQ== X-Gm-Message-State: AOJu0YwDTLRkMJ8SL46wFg5vg2wQGhLeh9x10qwTKrf8iMQ3nyCLSHzj /ZITkjKXBWeY+AbFeDa0bWp6dGsnUJa3HNwcUm0P+fwVNV9jnnRiinmpdvf3MMkugkPJ5oaHyFq Ujbn17Tp1C+42Wob5SNeI7t0/XSMR99yReYITM0DUmaZpyJMgFg== X-Google-Smtp-Source: AGHT+IGuxaL3pcRKYqFE7k64MKA40opXUHFSiNveaP0PEg/ZbZiropoAzo+pS3tCXgQ8g7NBHRl3lQjziZThYqPN4Tw= X-Received: by 2002:a5d:558d:0:b0:33b:2fc3:68c2 with SMTP id i13-20020a5d558d000000b0033b2fc368c2mr3198531wrv.25.1707099041843; Sun, 04 Feb 2024 18:10:41 -0800 (PST) MIME-Version: 1.0 References: <4c14e191-0605-4492-9f67-9a5b35ef132b@eastlink.ca> <4da0eeb4-4589-4c5d-9b89-a1a22209e18e@eastlink.ca> <7ccf5b82-a37d-47b5-a700-fb1096ab495c@eastlink.ca> <0875ffd7-e3a4-4ddc-9c4b-47e2c593ea4c@eastlink.ca> <1745fff9-822c-499f-b60e-7248e95438c5@app.fastmail.com> In-Reply-To: <1745fff9-822c-499f-b60e-7248e95438c5@app.fastmail.com> From: Bart Schaefer Date: Sun, 4 Feb 2024 18:10:30 -0800 Message-ID: Subject: Re: for loop 'bad math expression' To: zsh-users@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 29634 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: On Sun, Feb 4, 2024 at 12:49=E2=80=AFPM Lawrence Vel=C3=A1zquez wrote: > > I'm not sure if the zsh manual spells this behavior out explicitly, > but bash and ksh share it. "Arithmetic Evaluation" says (pretty far down after the discussion of operators): =3D=3D=3D Named parameters and subscripted arrays can be referenced by name within an arithmetic expression without using the parameter expansion syntax. For example, ((val2 =3D val1 * 2)) assigns twice the value of $val1 to the parameter named val2. =3D(and later)=3D Scalar variables can hold integer or floating point values at different times; there is no memory of the numeric type in this case. If a variable is first assigned in a numeric context without previously being declared, it will be implicitly typed as integer or float and retain that type either until the type is explicitly changed or until the end of the scope. This can have unforeseen consequences. =3D=3D=3D It doesn't explicitly say how "the value of $val1" is determined, but if it were expanded with $val1 you'd get the whole text string which would then be interpreted as arithmetic, so expanding without the $ works the same.