Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

almost floating point...



hi,

I like to use the arithmetic abilities of zsh often and have noticed
that 

z=1;
echo $(( $z + 1/3*6  ))

doesn't add 2 to 1 =3. I think the intermediate divide operation
confuses things somehow since

z=1;
echo $(( $z + 6/3  ))

does add  2+1=3.  I was wondering  what the rules for  this are? Also,
are there any  compact alternatives if one needs to  do batch floating
point computations through the shell without using PERL or AWK. For
example,

foreach file (numbers*.txt)
  < $file | <compute floating point here somehow>
end

Thank you for your time and consideration.  
----------------------------------------------------------------------
        Jose Unpingco   Mail Code ECE 0407; WK# (619) 534-5904
----------------------------------------------------------------------



Messages sorted by: Reverse Date, Date, Thread, Author