By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!c:\utils>set n=85
c:\utils>set /a "n/=2"
42
c:\utils>set /a "n/=2"
21
c:\utils>set /a "n/=2"
10
c:\utils>set /a "n/=2"
5
c:\utils>set /a "n/=2"
2
c:\utils>set /a "n/=2"
1
c:\users\jlc\utils>set n=85
c:\users\jlc\utils>set /a "n/=2"
42.5
c:\users\jlc\utils>set /a "n/=2"
21.25
c:\users\jlc\utils>set /a "n/=2"
10.625
c:\users\jlc\utils>set /a "n/=2"
5.3125
c:\users\jlc\utils>set /a "n/=2"
2.65625
c:\users\jlc\utils>set /a "n/=2"
1.328125
Well, "set /a n=n\2" is easy enough. But it should be noted that TCC's "SET /A" supports much that CMD doesn't.Not supported in CMD, so not supported in TCC. (The SET /A syntax is solely for CMD compatibility, as there's otherwise no reason to use it.)
v:\> set /a x=sin(PI/2)
1
v:\> set /a x=exp(1)
2.7182818285
v:\> set /a x=atan(1)
0.7853981634
v:\> set /a x=log10(100)
2
v:\> set /a x=2**3
8
v:\> set zz=0
v:\> timer do i=1 to 10000 (set /q /a zz+=3)
Timer 1 on: 21:35:31
Timer 1 off: 21:35:33 Elapsed: 0:00:01.48
v:\> echo %zz
30000
v:\> timer do i=1 to 10000 (set zz=%%@eval[zz+3])
Timer 1 on: 21:35:41
Timer 1 off: 21:35:43 Elapsed: 0:00:01.61
v:\> echo %zz
60000
Looks like a parsing error where SET /A is assigning a value to envvar "n\"