Just a minor oddity...

May 24, 2010
855
0
Northlake, Il
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?
 
May 20, 2009
293
5
57
ITALY
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
 
May 24, 2010
855
0
Northlake, Il
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
 
May 20, 2008
11,432
99
Syracuse, NY, USA
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.
 
May 24, 2010
855
0
Northlake, Il
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
 
May 20, 2008
11,432
99
Syracuse, NY, USA
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.
 
May 24, 2010
855
0
Northlake, Il
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
 
May 20, 2008
11,432
99
Syracuse, NY, USA
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.
 
May 24, 2010
855
0
Northlake, Il
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
Thread starter Title Forum Replies Date
Peter Murschall Some minor flaws Support 15
Alpengreis Documentation Minor issue in help file for view /E Support 1
D WAD Minor Post Installation Bug in V18 Support 1
dcantor Help file minor error Support 0
R Minor Cosmetic Issue in Take Command Window Support 2
D Minor problem. Incorrect value internal var _dir_files Support 7
jbanaszczyk help files: minor inconsistency Support 2
D Fixed Minor problem: output not alligned in the tree command Support 1
S Suggested minor improvements for www.jpsoft.com Support 5
M Just a minor annoyance re one particular plugin... Support 25
Dan Glynhampton Documentation v15 help: Minor niggles Support 0
Dan Glynhampton Documentation Minor issues with HELP Support 0
M A minor complaint... Support 9
M A (minor) limitation of @FileSize... Support 6
Charles Dye Minor nit: DIR /F, IFTP, colorization Support 4
vefatica Install two minor versions Support 4
A minor documentation fix - command line editing Support 0
A del /w [minor documentation fix] Support 0
A Minor documentation fix ["-" on command line] Support 3
Roedy WAD Minor long-standing install problems Support 6
M A minor but annoying issue with the "MD" command... Support 20
R A couple of minor issues with new forum. Support 4
M A somewhat humorous minor-request related to "Shift" command... Support 4
gschizas (minor) Help topic "Colors, Color Names and Codes" is wrong Support 0
M Minor "For" issue... Support 1
M A question about new behavior that’s a minor irritation… Support 16
M An undocumented limitation and an associated minor bug... Support 1
S SETARRAY - minor issue Support 0
H Minor bug in v12 SENDMAIL Support 0
J ZIP Help - minor quibble Support 0
S BDEBUGGER - minor issue Support 2
gschizas Minor (really minor) registration issue Support 0
S Virtual disk detection, minor enhancement requests Support 0
S Minor HELP issues Support 1
Charles Dye Minor installer quirk Support 1
samintz WAD DO /s /a:d oddity Support 7
vefatica Registry oddity Support 14
D v23 environment oddity Support 3
gentzel CompletePercents oddity Support 1
MickeyF @filewrite oddity (to me) Support 5
Fross Build 46 Oddity Support 5
M An oddity that's a little bit scary... Support 6
M A real oddity but not a real problem... Support 8
Dan Glynhampton Documentation v15 help: Another mailto: link oddity Support 0
M And oddity re the 32-bit TCC on a 64-bit system... Support 4
M WAD An oddity with the "Dir" command... Support 2
D Environment variable oddity Support 12
M An oddity... Support 5
Charles Dye @ERRTEXT oddity Support 6
Charles Dye INPUT prompt oddity Support 5

Similar threads