From owner-freebsd-chat@FreeBSD.ORG Mon May 19 12:38:49 2008 Return-Path: Delivered-To: freebsd-chat@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA0ED1065677 for ; Mon, 19 May 2008 12:38:49 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (unknown [IPv6:2a01:170:102f::2]) by mx1.freebsd.org (Postfix) with ESMTP id 379068FC17 for ; Mon, 19 May 2008 12:38:49 +0000 (UTC) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (localhost [127.0.0.1]) by lurza.secnetix.de (8.14.1/8.14.1) with ESMTP id m4JCclZe099027; Mon, 19 May 2008 14:38:47 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.14.1/8.14.1/Submit) id m4JCclFX099026; Mon, 19 May 2008 14:38:47 +0200 (CEST) (envelope-from olli) Date: Mon, 19 May 2008 14:38:47 +0200 (CEST) Message-Id: <200805191238.m4JCclFX099026@lurza.secnetix.de> From: Oliver Fromme To: freebsd-chat@FreeBSD.ORG, saltmiser@gmail.com In-Reply-To: <37f72b1f0805181418j16efd60fge243160dbfdc6789@mail.gmail.com> X-Newsgroups: list.freebsd-chat User-Agent: tin/1.8.3-20070201 ("Scotasay") (UNIX) (FreeBSD/6.2-STABLE-20070808 (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.1.2 (lurza.secnetix.de [127.0.0.1]); Mon, 19 May 2008 14:38:47 +0200 (CEST) Cc: Subject: Re: slide rules X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-chat@FreeBSD.ORG, saltmiser@gmail.com List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2008 12:38:49 -0000 Jim Capozzoli wrote: > So, I pulled out the slide rule yesterday that's older then I am..and > I figured out how to multiply/divide on it. Is there anybody out > there still using slide rules for day to day math? Or does anybody > have any interesting stories/reminiscences about slide rules? I was > considering figuring out how to do Trig on it and then taking my Trig > final with it. :) Well, I own a slide rule, it's in a drawer under my desk at home. But I have to confess that I almost never use it, because typing "bc -l" is much faster and delivers more accurate results. In fact I've bound "bc -l" to an inline hotkey of my shell's (zsh) command line editor, so the result is inserted at the cursor position. [*] Best regards Oliver [*] PS: For users of zsh, put this into your ~/.zshrc to bind the function to Esc M. # # Calculate an arithmetic expression using bc(1) # and insert the result at the cursor position. # user-insert-math-expression() { setopt localoptions extendedglob zle -I local X=$( stty sane <&2 read "X?Math expression: " <&2 echo -E "$X" | bc -l 2>/dev/null ) if [[ $? -ne 0 || -z "$X" ]]; then zle beep; zle -M "*** Error in math expression! ***" else if [[ "$X" == *.* ]]; then # Decimal point? X="${X%%0#}" # Remove trailing zeros. if [[ "$X" == .* ]]; then X="0$X" # Add zero before. fi fi LBUFFER="${LBUFFER}$X" fi } zle -N user-insert-math-expression bindkey '^[m' user-insert-math-expression -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M. Handelsregister: Registergericht Muenchen, HRA 74606, Geschäftsfuehrung: secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün- chen, HRB 125758, Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart FreeBSD-Dienstleistungen, -Produkte und mehr: http://www.secnetix.de/bsd "FreeBSD is Yoda, Linux is Luke Skywalker" -- Daniel C. Sobral