From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from minnie.tuhs.org (minnie.tuhs.org [45.79.103.53]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 825bd590 for ; Tue, 31 Dec 2019 04:13:22 +0000 (UTC) Received: by minnie.tuhs.org (Postfix, from userid 112) id 811829BC12; Tue, 31 Dec 2019 14:13:21 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id C2AFA9BBF3; Tue, 31 Dec 2019 14:12:50 +1000 (AEST) Received: by minnie.tuhs.org (Postfix, from userid 112) id E4BEA9BBF3; Tue, 31 Dec 2019 14:12:47 +1000 (AEST) Received: from mail.cs.dartmouth.edu (mail.cs.dartmouth.edu [129.170.212.100]) by minnie.tuhs.org (Postfix) with ESMTPS id 66CAE9BBF2 for ; Tue, 31 Dec 2019 14:12:47 +1000 (AEST) Received: from tahoe.cs.Dartmouth.EDU (tahoe.cs.dartmouth.edu [129.170.212.20]) by mail.cs.dartmouth.edu (8.15.2/8.15.2) with ESMTPS id xBV4CjuA1028345 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO) for ; Mon, 30 Dec 2019 23:12:45 -0500 Received: from tahoe.cs.Dartmouth.EDU (localhost.localdomain [127.0.0.1]) by tahoe.cs.Dartmouth.EDU (8.15.2/8.14.3) with ESMTP id xBV4CjT4015156 for ; Mon, 30 Dec 2019 23:12:45 -0500 Received: (from doug@localhost) by tahoe.cs.Dartmouth.EDU (8.15.2/8.15.2/Submit) id xBV4Ci4P015155 for tuhs@tuhs.org; Mon, 30 Dec 2019 23:12:44 -0500 From: Doug McIlroy Message-Id: <201912310412.xBV4Ci4P015155@tahoe.cs.Dartmouth.EDU> Date: Mon, 30 Dec 2019 23:12:44 -0500 To: tuhs@tuhs.org User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [TUHS] pic anomalies X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" According to K&R the behavior of % followed by something unexpected is undefined. So the behavior of Ralph's example is officially an accident. (It's uncharacteristic of Dennis to have defined printf so that there was no guaranteed way to get a literal % into a format.) Doug ------------------------------------------------ Ralph Corderoy wrote: $ printf '%s\n' \ .PS 'print sprintf("%.17g %.0f% % %%", 3.14, 42, 99)' .PE | > pic >/dev/null 3.1400000000000001 42% % %% Though that may seem odd to our modern C-standardised eyes, it's understandable in that if it isn't a valid %f, etc., format specifier then it's a literal percent sign.