You are correct that MOD works correctly when you feed it 64 bit values.
I was working on a puzzle ysterday:
Given the following set of 6 integers: 13000, 33333, 31416, 27813,
98765 and 43210. If the six integers are all multiplied together and the
resulting product is converted to base 12(twelve), in how many zeros will
the resulting value end in?
Using @eval I got :
echo %@eval[13000 * 33333 * 31416 * 27813 * 98765 * 43210]
1615860307974787525450800000
@convert only works with 64bit values so I had to convert it myself. So I
figured MOD and \ would do the trick.
echo %@eval[1615860307974787525450800000 mod 12]
7
But this yields a completely different result. I compute the remainder
(mod operator) by doing: (a/b - integer_part(a/b)) * b
echo %@eval[((1615860307974787525450800000 / 12) -
%@INT[1615860307974787525450800000 / 12]) * 12]
0
Same with / vs. \:
echo %@eval[1615860307974787525450800000 / 12]
134655025664565627120900000
echo %@eval[1615860307974787525450800000 \ 12]
768614336404564650
-Scott
rconn <> wrote on 02/19/2010 08:11:08 AM:
> ---Quote---
> > I could not find in the documentation anywhere what the definition of
> > an integer is. The help text for @EVAL states that \ and MOD require
> > integer parameters. However, I get wildly different results from
using
> > \ vs. /. I expected 10,000 digits. My definition of an integer is a
> > whole number with no fractional part.
> >
> > For example:
> >
> > Code:
> > ---------
> > set rmndr=%@eval[((%b10 / %2) - %@INT[%b10 / %2]) * %2]
> > set b10=%@int[%b10 / %2]
> >
> > gives completely different results from:
> >
> > set rmndr=%@eval[%b10 MOD %2]
> > set b10=%@eval[%b10 \ %2]
> > ---------
> ---End Quote---
> I can't make any sense out of your code fragment, but I'm pretty sure
> there's nothing wrong with the modulo operator.
>
> An integer in TCC is a 64-bit whole number.
>
> Rex Conn
> JP Software
>
>
>
>