From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: 1.75 -> 1-3/4 Date: Tue, 05 Jun 2018 20:06:45 +0200 Organization: Aioe.org NNTP Server Message-ID: <8636y13y6i.fsf@zoho.com> References: <86lgbt4cb6.fsf@zoho.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528222175 10194 195.159.176.226 (5 Jun 2018 18:09:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 5 Jun 2018 18:09:35 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jun 05 20:09:31 2018 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQGOg-0002V6-CF for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jun 2018 20:09:30 +0200 Original-Received: from localhost ([::1]:48431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQGQl-0000uC-P5 for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jun 2018 14:11:39 -0400 X-Received: by 2002:a1c:640b:: with SMTP id y11-v6mr17343wmb.13.1528222006893; Tue, 05 Jun 2018 11:06:46 -0700 (PDT) Original-Path: usenet.stanford.edu!20-v6no2214968wmu.0!news-out.google.com!n13-v6ni6801wmc.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: 6eD9/dIjTXG7gTjPBB9cGQ.user.gioia.aioe.org Original-X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.3 Mail-Copies-To: never Cancel-Lock: sha1:/9VfZ2kBV9TbhBaI2peseTOY344= Original-Xref: usenet.stanford.edu gnu.emacs.help:222851 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:116973 Archived-At: Marko Vojinovic wrote: >> ths () { >> local value=$1 >> local denom=${2:-16} >> local whole=$(( int(floor($value)) )) >> local rest=$(( $value - $whole )) >> local frac=$(( int(rint($rest * $denom)) )) >> if (( $frac > 0 && $(( $frac % 2 )) == 0 )); then >> local new_denom=$(( denom / 2 )) >> ths $value $new_denom >> else >> local frace >> (( $frac > 0 )) && frace=-${frac}/${denom} > > Umm, not to be a nitpick, but how about you > change the minus in the above line into > a plus? > > I mean, 1.75 is equal to 1+3/4, rather than > 1-3/4 (the latter obviously being equal to > 0.25). I kind-of assume you know what you are > doing, but still, other people may > get confused. Ha ha :D -- underground experts united http://user.it.uu.se/~embe8573