Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Just a minor oddity...

May
855
0
I was demonstrating the power of TCC to try to persuade a friend to actually buy it, and I got an odd result in so doing that I don't understand at all. Specifically
Code:
[Z:\]Echo %@Len[%@Eval[1E10000+PI=10000,10000]]
20000

[Z:\]Timer On & Echo %@Len[%@Eval[1E10000+PI=10000,10000]] & Timer Off
Timer 1 on: 22:09:55
20002
Timer 1 off: 22:09:55  Elapsed: 0:00:00.01
How and why do the timer command changed the length of the returned string from the @Eval function?
 
Code:
[Z:\]Echo %@Len[%@Eval[1E10000+PI=10000,10000]]
20000
 
[Z:\]Timer On & Echo %@Len[%@Eval[1E10000+PI=10000,10000]] & Timer Off
Timer 1 on: 22:09:55
20002
Timer 1 off: 22:09:55  Elapsed: 0:00:00.01
I do not know the meaning of these commands, but I tried them by copy and paste (in tcc alone) and I got the same results.
If, after that, I run again the first command in the same tcc window, I get again 20002, so it seems that there is a flag or a variable or a memory area that gets modified.
If I open another tcc window I get again 20000.
I am using TCC 15.01.43 on Windows 2003 [Version 5.2.3790], 32 bits.

Regards

Rodolfo Giovanninetti
 
Thank you for looking into it, Rodolfo. However, I get somewhat different results if I run the first one another time after running the second one. When I do this I get the original result - 2000 (which is what I would hope).

However, I investigated further and got these results (I will note that adding PI wasn't necessary, it was just to show that there really are that many digits after the decimal point and they don't have to be zero):
Code:
[Z:\]Echo %@Eval[1E10000=10000,10000] >WithoutTimer.txt
 
[Z:\]Timer On & Echo %@Eval[1E10000=10000,10000] >WithTimer.txt & Timer Off
 
[Z:\]fc WithoutTimer.txt WithTimer.txt
Comparing files WithoutTimer.txt and WITHTIMER.TXT
***** WithoutTimer.txt
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000
***** WITHTIMER.TXT
0000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000
*****
Since it my not be obvious, extracting just the "difference" lines:
Code:
0000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000
And there it is: two extra zeros.

And really weirdly (although it indicates that whatever is going on here is basically harmless) doing it again adding PI as in the original posting and comparing the results produces:
Code:
[Z:\]Echo %@Eval[1E10000+PI=10000,10000] >PIWithoutTimer.txt
 
[Z:\]Timer On & Echo %@Eval[1E10000+PI=10000,10000] >PIWithTimer.txt & Timer Off
Timer 1 on:  7:02:49
Timer 1 off:  7:02:49  Elapsed: 0:00:00.35
 
[Z:\]fc PIWithoutTimer.txt PIWithTimer.txt
Comparing files PIWithoutTimer.txt and PIWITHTIMER.TXT
***** PIWithoutTimer.txt
6723585020072452256326513410559240190274216248439140359989535394590944070469120914
093870012645600162374288021092764579310657922
9552498872758461012648369998922569596881592056001016552563756
***** PIWITHTIMER.TXT
6723585020072452256326513410559240190274216248439140359989535394590944070469120914
093870012645600162374288021092764579310657922
955249887275846101264836999892256959688159205600101655256375679
*****
Again highlighting the differences:
Code:
9552498872758461012648369998922569596881592056001016552563756
955249887275846101264836999892256959688159205600101655256375679
As you almost certainly can see in the above, the digits "79" are added to the result.

And if I do above again using "=40000" (the maximum value that is actually used is 10,000) I get the same results as immediately above, i.e. adding the inttial "Timer" command causes it to calculate two extra decimal digits.

And just to clarify exactly what is not as expected, the "WithoutTimer" versions have only 9,998 decimal digits meaning that they lack lack 2 decimal digits that they should have.

And to explain exactly what I was doing, Rodolfo, "@Eval" evaluates the contained expression, the "=10000,10000" indicates how many decimal places you want the result to have (10,000 obviously), and adding PI makes those extra 10,000 decimal places non-zero.

- Dan
 
Apparently you have exceeded the 20000 (with NUL terminator) character limit on the length of a single parameter. Both of these are correct.
Code:
v:\> echo %@len[%@eval[1E10000+PI=9997,9997]]
19999
 
v:\> timer & echo %@len[%@eval[1E10000+PI=9997,9997]] & timer
Timer 1 off: 11:02:22  Elapsed: 0:03:41.83
19999
Timer 1 on: 11:02:22

When I make the string one byte longer, I get an error.
Code:
v:\> echo %@len[%@eval[1E10000+PI=9998,9998]]
TCC: The argument is too long "1000000(SNIP)563757"

Your first example (without TIMER) is incorrect. The correct length is 20002. I don't know why you're not getting an error, but the truncation is no surprise.
 
Vince,

Ignoring for the moment everything else you say above, the only difference between the two of them is the "Timer" command - and it's the one with the "Timer" command that has the longer result. Given that, I really don't understand any of what you say above. And I do not get the error you are getting entering your example verbatim.

TCC 15.00.34 x64 Windows 7 [Version 6.1.7601]

- Dan
 
According to the help (see "Limits") the maximum size of a parameter is 20000 characters. You're giving @LEN a parameter with 20002 characters. I doubt Rex can program for predictable behavior in every possible "garbage-in" situation.

And since you're 9 builds behind the times I doubt it would be fruitful to continue this conversation.
 
Well, Vince, this is the best possible response to your complaints:
Code:
TCC  15.01.44 x64  Windows 7 [Version 6.1.7601]
Copyright 2013 JP Software Inc.  All Rights Reserved
Registered to Daniel Mathews
 
Z:\>Echo %@Len[%@Eval[1E10000+PI=10000,10000]]
20000
 
Z:\>Timer On & Echo %@Len[%@Eval[1E10000+PI=10000,10000]] & Timer Off
Timer 1 on: 15:20:56
20000
Timer 1 off: 15:20:56  Elapsed: 0:00:00.02
I really don't think I have to add anything more.

- Dan
 
Well, Vince, this is the best possible response to your complaints:
Code:
TCC  15.01.44 x64  Windows 7 [Version 6.1.7601]
Copyright 2013 JP Software Inc.  All Rights Reserved
Registered to Daniel Mathews
 
Z:\>Echo %@Len[%@Eval[1E10000+PI=10000,10000]]
20000
 
Z:\>Timer On & Echo %@Len[%@Eval[1E10000+PI=10000,10000]] & Timer Off
Timer 1 on: 15:20:56
20000
Timer 1 off: 15:20:56  Elapsed: 0:00:00.02
I really don't think I have to add anything more.

- Dan

I have no complaint. Do you have one now that the two agree?

Do you understand that they are both wrong? The string you asked for has 20002 characters ... 10001 integer digits, a decimal point, and 10000 digits after the decimal point.
 
Vince, I suppose "wrong" is a matter of perspective. The documentation clearly says (I'm too lazy to go try to find it right now to direct you to it) that precision(s) greater than the maximum allowed are just treated as if the were the maximum allowed. I was also too lazy when I first did it to try to figure out what the actual maximum allowed was (particularly since I really didn't need to), I knew it was somewhere less than or equal to 10,000 and specifying 10,000 was good enough.-

- Dan
 

Similar threads

Back
Top