From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24222 invoked by alias); 14 May 2015 17:54:35 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35135 Received: (qmail 8759 invoked from network); 14 May 2015 17:54:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:cc:mime-version:content-type; bh=NzFqd+Yn+S3LgqapNPizVoCGecJCb83aj38MI8HikTk=; b=k2XpXoPeapShnsDDL54ADuoUOe08UiiUgu5o6JYDwJBVlFFr2v/7gDeaUu5ixtt7BP hk9gDR8FPWT9V9N7nABb2+3/c2ybw91oKJY9nsKUpBxa22DO7IkwGru84zIt7SKykIY6 vzQ1+B+aR6QKtAkaqbauiOUFhFoH7UEoDUAi7mtp2zaTyZUsCt8TPyK5o7xgbiEdIfWQ 6SbysPagNJ3tqB5S3ik/wNAlGFd4UkcBLWlaobiuDUk2YYugpnjZOLruex4P0F3gOctV DVGpqjVZzSQ2xebSWdzuMfE/j6vUY9fqwzPctucZQf7zSwEkPM8g1/lMX3it8JWUU7hn 3Nxw== X-Gm-Message-State: ALoCoQkSSXvXmcZb9Lal2j59LFjSeIcO3pwcM2Zc2ngbgSWfBmvYVquExDxcKEeRbXxpRhq2QkNs X-Received: by 10.202.210.194 with SMTP id j185mr4299044oig.68.1431626072049; Thu, 14 May 2015 10:54:32 -0700 (PDT) From: Bart Schaefer Message-Id: <150514105426.ZM30800@torch.brasslantern.com> Date: Thu, 14 May 2015 10:54:26 -0700 In-Reply-To: <87oalncyjw.fsf@debian.uxu> Comments: In reply to Emanuel Berg "Re: why do ceil/floor give the decimal dot?" (May 14, 11:12am) References: <87oalodmns.fsf@debian.uxu> <150513195617.ZM29493@torch.brasslantern.com> <87d223et0a.fsf@debian.uxu> <150513210405.ZM29616@torch.brasslantern.com> <87oalncyjw.fsf@debian.uxu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: why do ceil/floor give the decimal dot? Cc: Emanuel Berg MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 14, 11:12am, Emanuel Berg wrote: } Subject: Re: why do ceil/floor give the decimal dot? } } Bart Schaefer writes: } } > If what you want to argue is that floating point } > values that happen to be whole numbers should not } > print the trailing dot, that's another discussion. } } You mean like this? } } $ printf "%d\n" $(( 7.5 + 0.5 )) } 8 No, I mean that looking at this: torch% float X=27 torch% print $X 2.700000000e+01 torch% print $(( X )) 27. torch% printf "%f\n" $X 27.000000 torch% printf "%g\n" $X 27 One might wonder why there are four different representations of the same number, and we could therefore discuss whether some of them should be unified. This is not the same discussion as whether they should be converted to integers. I don't imagine we have much leeway with printf, but ksh uses the "%g" style for each of the first two cases instead of using scientific or decimal notation. I don't recall why zsh chose the other formats. The problem changing the output reprsentations is that it potentially changes the interpretation of $(( $X )) to be different from $(( X )).