On Thu, Jun 18, 2009 at 6:41 PM, Kumar Appaiah <[email protected]>wrote:
> > > > > > From the bc man page: > > > > > > "expr % expr > > > The result of the expression is the "remainder" and it > > > is computed in the following way. To compute a%b, first a/b is > > > computed to scale digits. That result is used to compute a-(a/b)*b to > > > the scale of the maximum of scale+scale(b) and scale(a). If scale is > > > set to zero and both expressions are integers this expression is the > > > integer remainder function." > > > > Now, the default "scale" in bc is 0, which takes all fractions to the > integer preceding them. e.g. 15/8 evaluates to 1. Now, try your > expression. -2/-3 is 0, then -2 - (-2/-3)*-3 is -2. Thanks for the explanation of how bc does the job of calculating the remainder. Mayank -- http://mm.glug-bom.org/mailman/listinfo/linuxers

