Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mit-eddie!uw-beaver!tektronix!tekgen!puffin!penguin!richl From: richl@penguin.USS.TEK.COM (Rick Lindsley) Newsgroups: comp.unix.questions Subject: Re: Floating-Point Arithmetic in a Csh Script Message-ID: <271@puffin.USS.TEK.COM> Date: 25 Apr 88 21:39:57 GMT References: <1748@ut-emx.UUCP> Sender: news@puffin.USS.TEK.COM Reply-To: richl@penguin.USS.TEK.COM (Rick Lindsley) Organization: Tektronix, Inc., Beaverton, OR. Lines: 20 In article <1748@ut-emx.UUCP> jjr@ut-emx.UUCP (Jeff Rodriguez) writes: This is the best that I've come up with: #!/bin/csh # This csh script computes x = $1 + $2, # where $1 and $2 are floating-point numbers. bc << END > temp scale = 5 $1 + $2 END set x = `cat temp` Can anybody think of a better way? How about: set x = `echo "scale=5; $1 + $2" | bc` Same effect, less space. Rick