December 3, 200520 yr Thanks Bill,I'll tinker some more and it will sink in.I'm thinking at present that by chosing the modulus correctly, the required number can be extracted from a much longer value.Would I be correct in this? I use multiples of 10 myself to extract certain individual digits, but using the correct value of modulus could extract any required value. How would you define the ultimate use of modulus in XML coding. A worded definition would be useful.BTW, >Worse, still, 123 100 % will not be equal to 1!I don't think you saw the 'r' in the line to reverse the stack to obtain a value of 1.cheers,nick
December 3, 200520 yr Hi Ron, how does one obtain a oopy of Jet Test? I've searched here and the 'other place'nick
December 4, 200520 yr >Hi Ron, how does one obtain a oopy of Jet Test? I've searched>here and the 'other place'>nick 'Jet Test' is an XML 'gauge' I started before FS9 came out. I have slowly added calculations and modified the two Display windows as time goes on. I'm afraid I'd never understand the current version if I hadn't worked it out, bit by bit. It displays many of the things AFSD does, but is faster, and one can modify the Display windows by editing the strings. Or, bring up just the window that displays what he is interested in. However, to display some flight parameters, such as Drag, it requires an 'Aircraft XXX.ini' file that has to be edited with a few lines of data based on the AIR file and aircraft.cfg. While AFSD reads these files directly. I have a simpler 'Prop Test', which has the code and display lines in one xml file. It displays %HP, Prop Thrust, Efficiency, Range, and more basic parameters. I've sent various versions of Jet Test to a few individuals I know. I don't recommend it in general, due to the complexity and the need to set the 'Aircraft ...ini' file. Further, the main display shows quite a few parameters with names only an engineer might recognize. ;) Email me if you are still interested. ;) Ron
December 4, 200520 yr > Email me if you are still interested. ;)Hi Ron,if you don't mind, i'm interested in it as well :DMarco "Society has become so fake that the truth actually bothers people".
December 4, 200520 yr >> Email me if you are still interested. ;)>>Hi Ron,>if you don't mind, i'm interested in it as well :D>Marco You can email me directly by clicking on my name. I've archived a recent version of Jet Test with my B707-320C FD files and a modified Lear.cfg panel which shows how to set the 'gauges'. Ron
December 4, 200520 yr Author >>BTW, >Worse, still, 123 100 % will not be equal to 1!>I don't think you saw the 'r' in the line to reverse the stack>to obtain a value of 1.>cheers,>nick123 100 % r should give 0 or the value existent in the stack before 123, because both 123 and 100 values are extracted from the stack by the % operator.BTW, one form of "imitating" modulus in XML could be:123 2 % = 123 d 2 / int 2 * - Indeed seems easier to use %...Tom
December 4, 200520 yr >123 100 % r should give 0Are you sure? Basically, 23 is 'stripped out' and placed on top of the stack, and the 1 is pushed down the stack, so a stack reversal should reinstate the 1?cheers,nick
December 4, 200520 yr Author >>123 100 % r should give 0>Are you sure? Basically, 23 is 'stripped out' and placed on>top of the stack, and the 1 is pushed down the stack, so a>stack reversal should reinstate the 1?>cheers,>nickI am sure :-)Whatever operation you do between two values placed on the stack will mean both being extracted an replaced by the result of the operation.ie 2 3 Stack=3 22 3 * Stack=65 2 3 * Stack=6 5 5 2 3 * - Stack=-12 3 * r Stack=0 65 2 3 * r Stack=5 6 etc, etc,Tom
December 4, 200520 yr 123 100 % r is indeterminate on its own because it will return whatever was on the top of the stack before it was executed. Consider the following states of the stack, the top of the stack (<-)first:X (<-initially)100 (<-immediately before executing %)123X23 (<-the modulus after executing %)XX (<-after executing r)23 Incidentally what does XML do if the stack is empty and an attempt is made to access the top (nonexistent) value? In general, what does XML do in other similar error situations, such as using non-integer values for the % operators. C/C++ would throw an exception or a complile time error. Gerry Howard
December 4, 200520 yr Author >123 100 % r is indeterminate on its ownHowever seems so, it is not indeterminated but equals 0>because it will return whatever was on the top of the stack before >it was executedThat is correct. BUT, an empty stack will return 0 any time you command an extraction from it, either through a (>L:Var) assignment, a calculation (ie + + ), etc.Some examples (>L:Var1,number) (>L:Var2,number) (>L:Var3,number)is the same as0 (>L:Var1,number) 0 (>L:Var2,number) 0 (>L:Var3,number)+ + - (>L:Var1,number)is the same as 0 (>L:Var1,number) / (>L:Var1,number) 0 / (>L:Var1,number)1 / (>L:Var1,number)1 0 / (>L:Var1,number)ALL are the same as 0 (>L:Var1,number). And yes, even a division by 0 gives no error but 0 !!! >>Incidentally what does XML do if the stack is empty and an>attempt is made to access the top (nonexistent) value? In>general, what does XML do in other similar error situations,>such as using non-integer values for the % operators. C/C++>would throw an exception or a complile time error. There is no error here, as noted on the lines above.TomEDIT: modulus in XML will work with integer, non integer and negativevalues without any trouble.
December 5, 200520 yr Thanks for the information.I still regard popping 0 when the stack is empty is an error. It's ambiguous because it doesn't distinguish between an empty stack and one with 0 on top. A programmer might believe there was a genuine value on top of the stack and and make use of that in calculations giving an unexpected (erroneous) result. Similar considerations apply to dividing by 0 without any warning.Does anyone know of a XML package to aid development? I'd imagine Microsoft will have one! Gerry Howard
December 5, 200520 yr Hi Tom, I'm now confused.123 100 % r123/100=1.23neglect the remainder,A=123-(1*100)=23so 23 is placed on the top of the stack.What is pushed down the stack, is it 123 or 100, I suspect it is 123 (sorry, I think I said 1 before).then the 'r' reverses the stack, so is 100 or 123 put back on top and the 23 is pushed down the stack?cheers,nick
December 5, 200520 yr Author Nick,This is how it works:Value ----> Stack return (top-bottom)(Empty)---->0 (implicit)123------>123 0 100------>100 123 0 %-------->23 0 (both 123 and 100 are popped and discarded)r-------->0 23If instead you have any value on the stack before 123 is placed , r will put that value on top (ie 45 123 100 % r gives 45 on top)Hope this is clear enough to be useful to you :)BTW, I understand what you're looking for is an easy way to extract any digit from a value without the need to remember those 10000 + 100 % 10 / etc etc.? I use a very simple macro that does the work for me very good...and can post it if you're interested.Regards,Tom
December 6, 200520 yr Tom,Interested too.May be helpful for all those rolling numbers etc.Jan"Beatus ille qui procul negotiis..." Jan "Beatus ille qui procul negotiis..."
December 6, 200520 yr Author Ok JanThis is the macro: @1 sp0 @3 0 > if{ l0 10 @3 pow * sp0 } l0 int 10 @2 pow % 10 @2 1 - 0 max pow / int And the calling:@ExtDigit((ALGVar),nDigit,nDecimals)Where:(ALGVar) is the A,L or G var from where to extract the digitnDigit is the position of the digit to extract, starting from the right (honor to RPN!:-))nDecimals is the number of decimals to be included in the calcs.For instancefor a value of 123.456789999999@ExtDigit(lVar,1,0) means I want to extract the right most, discarding the decimals. It returns 3@ExtDigit(lVar,2,0) returns 2 ; @ExtDigit(lVar,3,0) returns 1 and@ExtDigit(lVar,4,0) and up returns 0using decimals:@ExtDigit(lVar,1,2) returns 5 @ExtDigit(lVar,2,2) returns 4 @ExtDigit(lVar,3,2) returns 3 @ExtDigit(lVar,4,2) returns 2 etc etc.As you can see, is a simple but powerful solution to get rid of those 100 % 10 flr,etc..when working with rolling numbers or something similar. Tom
Create an account or sign in to comment