From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21151 invoked by alias); 26 Jul 2010 09:14:29 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15199 Received: (qmail 29307 invoked from network); 26 Jul 2010 09:14:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) 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, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Mon, 26 Jul 2010 10:13:53 +0100 From: Peter Stephenson To: Zsh Users Subject: Re: Rounding of glob qualifiers? Message-ID: <20100726101353.7048f070@csr.com> In-Reply-To: References: Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Jul 2010 09:14:15.0538 (UTC) FILETIME=[EB5EE520:01CB2CA2] X-Scanned-By: MailControl A_09_40_00 (www.mailcontrol.com) on 10.68.0.126 On Fri, 23 Jul 2010 16:09:33 -0400 (EDT) "Benjamin R. Haskell" wrote: > The rounding seems a bit odd here: > > ## some files less than, equal to, and greater than 1024 bytes > $ ls -l {lt,eq,gt}-1k > -rw------- 1 bhaskell users 1023 2010-07-23 16:08 lt-1k > -rw------- 1 bhaskell users 1024 2010-07-23 16:08 eq-1k > -rw------- 1 bhaskell users 1025 2010-07-23 16:08 gt-1k > > ## why does lt-1k match here: > $ print -l *-1k(L-1024) > lt-1k > > ## and here: > $ print -l *-1k(Lk1) > eq-1k > lt-1k > > ## but not here? > $ print -l *-1k(Lk-1) > zsh: no matches found: *-1k(Lk-1) > > > Not claiming it's a 'bug', per se, but what's the rationale for > rounding up? Seems similar to the 'a' glob qualifier caveat with > 'whole units', but I didn't see an explanation similar to > fractional-part-is-discarded for 'L'. Yes, it's the same point, because it's the same logic. It should really be described higher up. I'm not sure it's ever actually useful to discard the fractional part when comparing less than or greater than; equality is a bit different because when you want a file a certain number of K it's unlikely you wan't it to be exactly that size, just more than the next unit down and less than the next unit up. You get the behaviour for other comparisons out of consistency with this. -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom