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,NICE_REPLY_A,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 10204 invoked from network); 26 Mar 2021 00:38:40 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 26 Mar 2021 00:38:40 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1616719120; b=ix+4ot0LWrDy5PJd2kDNDioPe4QdvqVjBJ5Lny/7Yww4bZPmHH7HEX+07tQkfZf3ysVb0leEd9 SrGLrFwWKnxS3Kcgdx4TebK/awZUqbpLvwQI83bt1sjq0mG7k/RxECaWnbHcFUd1qpWUmsNyu0 00X9j6RzkdarRCaQJQZbPgOT76nJp9WMCvLi00V8xzhD1AZMVZ4EQ0iYG9cnchQrVF/X1u+ZDA 48+e/sBy8hhW+B8KYCWsDQXPZh7UyZg+aWosK9CreIvCK0+BJgxEmtgKaKl8rxNhVEZur3/uyq g/CiYwnmslh29Q9T6d40gpX3EohDD49KBQS1P0ByU9jkMw==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1616719120; bh=5Oxg51OXi4aKdHeJKCOtLZmZi9anlHvCzLN0Qi1qM+s=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:To:Subject:DKIM-Signature; b=Yufw228bhMSC5Annl5k/vC+qIyZVFYcq+HmnqIXDgBfGxqm5mK5dAOs+GpirAANoF0nbixuMyS 33aS9j6j7xMa+aQMPQLvBeOsczuFNaGg0mkF6CVeUTwkT8RxcgM5LYY9uG3WWIt4kMzRSbesPY ilADOdNIk+rR/J3AEB/37JrF+MXgxuqm5dYTufU4s1n9wOd1EKV+6ODjbpccZuC/3rJFGhObGg ogYHgcvi7T1cSBoy7okH/JFlG5npT8dR9eP7V7ZS8kvnamnQJ1iiZJJECDsjt6U/uOjdpHroGQ nhkM4/ainr8frBAdtN2tUDImPOUtooX9wbLFuaSll16B2A==; 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:Content-transfer-encoding: Content-type:In-reply-to:MIME-version:Date:Message-id:From:References:To: Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=elG4t3CYcCV/pdvGqdJbzBswWyZA321FFw3tkyUyhPc=; b=Rxe37F9BqQ+51u3e+yLxh9D6fe jdu201ne22uPzfNtdLF/obGhgnD+64DdIRLLbuWknsQEBCKZiN+JGxMXDmnz9mMTOA8Vmd7sxGNjy K0zdsQ0VLaRU2tbNJP8OAJuuX0UbD7UNhRRQHk0o7gN75K8KW3MAzfBWRfp8p/9OL/pT8+O5bAZlz CVdNRhAwhi3AEtkGjFcdPcezXVTQhW+FhH+4Vcaa34HpMau+vrbcRP4YxcqL2bIpnuOIkrywEVUuP 5LrQz94BdbS+picJBzuGDVxBxAQGvFk5DVFmndas8YNwUfPOfVAJNJTtZJwDrjm7JbeGJb1qOfxZ8 54thaYQg==; Received: from authenticated user by zero.zsh.org with local id 1lPaUj-00070L-BX; Fri, 26 Mar 2021 00:38:33 +0000 Authentication-Results: zsh.org; iprev=pass (mta02.eastlink.ca) smtp.remote-ip=24.224.136.13; dmarc=none header.from=eastlink.ca; arc=none Received: from mta02.eastlink.ca ([24.224.136.13]:38440) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) id 1lPaU3-0006RY-SL; Fri, 26 Mar 2021 00:37:52 +0000 Received: from csp02.eastlink.ca ([71.7.199.167]) by mta02.eastlink.ca (Oracle Communications Messaging Server 8.0.2.2.20180531 64bit (built May 31 2018)) with ESMTPS id <0QQJ00B58VOXK4O1@mta02.eastlink.ca> for zsh-users@zsh.org; Thu, 25 Mar 2021 21:37:50 -0300 (ADT) Received: from [192.168.0.3] ([24.207.90.194]) by Eastlink with ESMTP id PaU1lHo1154V7PaU1lNfm9; Thu, 25 Mar 2021 21:37:50 -0300 X-Authority-Analysis: v=2.4 cv=PJ/KRdmC c=1 sm=1 tr=0 ts=605d2cde a=zv49KfEsxEDzuN5AGO7r0Q==:117 a=zv49KfEsxEDzuN5AGO7r0Q==:17 a=IkcTkHD0fZMA:10 a=G7NjIGlt26M5NNUvI18A:9 a=QEXdDO2ut3YA:10 a=fCgQI5UlmZDRPDxm0A3o:22 X-Vade-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudehuddgvdefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecugfetuffvnffkpffmpdfqfgfvnecuuegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptfgrhicutehnughrvgifshcuoehrrgihrghnughrvgifshesvggrshhtlhhinhhkrdgtrgeqnecuggftrfgrthhtvghrnhepkedvueeuffefhfdvueeiteffvddtvdejgeeujeekieduheeiteeiheegtedvhfefnecukfhppedvgedrvddtjedrledtrdduleegnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepvdegrddvtdejrdeltddrudelgedphhgvlhhopegludelvddrudeikedrtddrfegnpdhmrghilhhfrhhomheprhgrhigrnhgurhgvfihssegvrghsthhlihhnkhdrtggrpdhrtghpthhtohepiihshhdquhhsvghrshesiihshhdrohhrghdpghgvthdqkghiphfrrghsshifugepthhruhgv X-Vade-Score: 0 X-Vade-State: 0 X-EL-IP-NOAUTH: 24.207.90.194 Subject: Re: arithmetic anomaly To: zsh-users@zsh.org References: <0227b30d-4f09-2c8b-1248-557859d875ce@eastlink.ca> <91303-1616717760.288585@Iyj2.F9RA.VD0P> From: Ray Andrews Message-id: Date: Thu, 25 Mar 2021 17:37:49 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.0 MIME-version: 1.0 In-reply-to: <91303-1616717760.288585@Iyj2.F9RA.VD0P> Content-type: text/plain; charset=utf-8; format=flowed Content-transfer-encoding: 8bit Content-language: en-US X-Seq: 26607 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: Archived-At: On 2021-03-25 5:16 p.m., Oliver Kiddle wrote: > Ray Andrews wrote: >>     printf "%.0f / %.0f \n" "$(( numerator ))" "$(( denominator ))" > Where you use %f, %d etc. the printf parameters are evaluated in math > context so there's no need to convert via ASCII decimal representation > with "$(( … ))". You can just do: > > printf "%.0f / %.0f \n" numerator denominator Thanks.  Actually I just figured that out myself. > e of the shell rather than floats > but floats are what we have. But why do we let them spew out garbage?  Just now I experimented with " %d " as the output specifier and it very politely goes obviously wrong at level 16 so you know it's reached the end of its rope, but the floats just keep on floating way into nonsense.  Very unhygienic.