[geeks] expr and math

Sandwich Maker adh at an.bradford.ma.us
Tue Sep 21 14:59:26 CDT 2004


" From: Scott Howard <scott at doc.net.au>
" 
" On Tue, Sep 21, 2004 at 04:00:48AM -0500, Brian Dunbar wrote:
" > briandunbar_natasha_~:expr 90 \* 100000000
" > 410065408
" 
" expr generally works on "integers" as defined by the system. ie, once you
" hit MAX_INT weird stuff will happen.
" 
" If you want unlimited precision math, use bc

or, in ksh, $(( )):

print $((90 * 1000000000))

works fine.  and of course for you douglas adams fans,

typeset -i13 ANS=$((6*9))
print "the ultimate answer to life, the universe, and everything is... ${ANS#13#}"
________________________________________________________________________
Andrew Hay                                  the genius nature
internet rambler                            is to see what all have seen
adh at an.bradford.ma.us                       and think what none thought



More information about the geeks mailing list