From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19356 invoked by alias); 14 May 2015 04:04:13 -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: 35120 Received: (qmail 7315 invoked from network); 14 May 2015 04:04:11 -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:mime-version:content-type; bh=iTV5cpR2FXxzt1MEClsoICH/SijExGi3zQ0ZGijxKuY=; b=GGK882c27e6Cz0U0BvV6/D6oag6dhK29RfYT4cjI8s76LuiIaSBsWvlTNDShgPd72+ nVWM1LsciIDeQ3It6o6DV1Gx24noB6alQNCEvXzg94jHWLS7SWnHMecGb8EjV9gUpiam mPnC/jzAXTWDCFy0E1tycQkQMSMc/hj0QTUiD5ueW0AY3DSmnP1QuY2vucMgnOVONj4J g4/i+9y+xBPzCiGrtnic9v9pw9EauqqpQxYqyxKjrC42jpFOHGBvqR91RxZ7h+JU0jva XgUBSdufmNndzMa9iM8bew4ubT7DlAno+N6UbDE7sLl3xf5bAuji7OHq9qyxYRjEqVky tdRg== X-Gm-Message-State: ALoCoQkWwrm+RbIFGXWYSAYK7qlHkjypRQFkKZDZWFb4u8A4Lg8XDM8VNzgwcUYyOGzBDzvbMLpK X-Received: by 10.202.69.130 with SMTP id s124mr1715478oia.70.1431576249466; Wed, 13 May 2015 21:04:09 -0700 (PDT) From: Bart Schaefer Message-Id: <150513210405.ZM29616@torch.brasslantern.com> Date: Wed, 13 May 2015 21:04:05 -0700 In-Reply-To: <87d223et0a.fsf@debian.uxu> Comments: In reply to Emanuel Berg "Re: why do ceil/floor give the decimal dot?" (May 14, 5:29am) References: <87oalodmns.fsf@debian.uxu> <150513195617.ZM29493@torch.brasslantern.com> <87d223et0a.fsf@debian.uxu> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Emanuel Berg , zsh-workers@zsh.org Subject: Re: why do ceil/floor give the decimal dot? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 14, 5:29am, Emanuel Berg wrote: } } prefix-len () { } local hosts=$1 } echo $(( 32 - int(ceil(log($hosts)/log(2))) )) } } } } without the integer conversion, the output for } } prefix-len 30 } } isn't 27, but "27." Yes, because as in most languages all integers in a mixed-type expression are converted to floating point before the operation is carried out, so $(( 32 - anyfloat )) becomes $(( 32. - anyfloat )) and results in a float. 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.