From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by nuthatch.gentoo.org with esmtp (Exim 4.50) id 1EeWXF-0002mP-26 for garchives@archives.gentoo.org; Tue, 22 Nov 2005 11:42:05 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id jAMBdrCF017730; Tue, 22 Nov 2005 11:39:53 GMT Received: from mail.gmx.net (mail.gmx.de [213.165.64.20]) by robin.gentoo.org (8.13.5/8.13.5) with SMTP id jAMBWM78003568 for ; Tue, 22 Nov 2005 11:32:22 GMT Received: (qmail 27279 invoked by uid 0); 22 Nov 2005 11:32:22 -0000 Received: from 157.247.252.14 by www39.gmx.net with HTTP; Tue, 22 Nov 2005 12:32:22 +0100 (MET) Date: Tue, 22 Nov 2005 12:32:22 +0100 (MET) From: jarry@gmx.net To: gentoo-user@lists.gentoo.org Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Subject: [gentoo-user] OT: bash & decimal/exponential numbers math... X-Priority: 3 (Normal) X-Authenticated: #787166 Message-ID: <21449.1132659142@www39.gmx.net> X-Mailer: WWW-Mail 1.6 (Global Message Exchange) X-Flags: 0001 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by robin.gentoo.org id jAMBdrCX017730 X-Archives-Salt: 7143c5d5-105a-4d39-8e96-a5f7012656e8 X-Archives-Hash: 9fb67e4b19e5ea4a0d0ada9f8a662e6a Hi, I wrote a short script for simple text file processing in bash (using "<" for input redirection and "read"). I know, there are probably better tools to do it, but the only thing I can rely on being installed on target comp is really bash and nothing more (no bc, sed, awk, etc.) so I must use only its built-in functions.=20 Everything would be OK, if there were only positive integer numbers in that input file. Unfortunatelly, there are also decimal and exponential numbers (like 123.456 or 1.23456e+02) which my script must process. Now I'm pretty deadlocked because too late I realised that very basic math functions of bash can not handle such numbers. Now what to do? Are there some functions, which would implement basic math with real numbers in bash (add, substract, multiply, divide and round would be enough)? The idea of writing them myself really scares me... Jarry --=20 10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail +++ GMX - die erste Adresse f=FCr Mail, Message, More +++ --=20 gentoo-user@gentoo.org mailing list