I have a three digit DME that displays the distance with tenths when it is less than 99.9 miles.
I'm trying to follow the Extracting Digits Wiki for the following:
"Rotating Drum Example
To simulate a Rotating Drum number using a value of three integer digits (for example (L:Var, number) = 135) where the preceding number starts to rotate at 90% of the number to its right:
-for the first rightmost integer digit (5) = (L:Var, number) 1 % @ExtDigit((L:Var, number),1,0) +
-for the second rightmost digit (3) = (L:Var, number) 10 % s1 9 >= l1 9 - * @ExtDigit((L:Var, number),2,0) +
-for the third rightmost digit (1) = (L:Var, number) 100 % s1 99 >= l1 99 - * @ExtDigit((L:Var, number),3,0) +"
I have no experience working with stacks and registers, so I don't understand the "mechanics" of this "s1 9 >= l1 9 - *" part of the example code.
In addition to my confusion over the 90% example, I am more lost with the 80% example "s1 8 >= l1 8 - 2 / *". Why does this example have the division in it?
Apparently it is a computer math thing that I am not seeing, or don't know.
So, what if one wanted 70 or 75 percent, what would change in that part of the statement?
I haven't been able to get the tens digit of my DME working correctly. I'm not sure about the ones digit but, it appears to work OK.
My tens digit is doing this:
Inbound at 9.9 miles, the tens digit is still showing a one and then it starts to decrement. It decrements probably 10% for every tenth of a mile, until it reads zero when you are at 9 miles. Outbound, the tens digit starts to increment in a similar way when you hit 9.0 miles.
I hope that the following is all the relevant code and that someone can see the obvious error(s) in it:
Besides the ExtDigit macro, I also use:
TIA
I'm trying to follow the Extracting Digits Wiki for the following:
"Rotating Drum Example
To simulate a Rotating Drum number using a value of three integer digits (for example (L:Var, number) = 135) where the preceding number starts to rotate at 90% of the number to its right:
-for the first rightmost integer digit (5) = (L:Var, number) 1 % @ExtDigit((L:Var, number),1,0) +
-for the second rightmost digit (3) = (L:Var, number) 10 % s1 9 >= l1 9 - * @ExtDigit((L:Var, number),2,0) +
-for the third rightmost digit (1) = (L:Var, number) 100 % s1 99 >= l1 99 - * @ExtDigit((L:Var, number),3,0) +"
I have no experience working with stacks and registers, so I don't understand the "mechanics" of this "s1 9 >= l1 9 - *" part of the example code.
In addition to my confusion over the 90% example, I am more lost with the 80% example "s1 8 >= l1 8 - 2 / *". Why does this example have the division in it?
Apparently it is a computer math thing that I am not seeing, or don't know.
So, what if one wanted 70 or 75 percent, what would change in that part of the statement?
I haven't been able to get the tens digit of my DME working correctly. I'm not sure about the ones digit but, it appears to work OK.
My tens digit is doing this:
Inbound at 9.9 miles, the tens digit is still showing a one and then it starts to decrement. It decrements probably 10% for every tenth of a mile, until it reads zero when you are at 9 miles. Outbound, the tens digit starts to increment in a similar way when you hit 9.0 miles.
I hope that the following is all the relevant code and that someone can see the obvious error(s) in it:
Besides the ExtDigit macro, I also use:
Code:
<Macro Name="Distance">
(A:NAV DME:1, nmiles)
</Macro>
<!--Tenths-->
<Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 < && if{ @Distance 0.1 % 10 * @ExtDigit(@Distance,1,1) + }</Value>
<!--Ones-->
<Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 < && if{ @Distance 1 % s1 0.9 >= l1 0.9 - * @ExtDigit(@Distance,2,1) + }</Value>
<!--Tens-->
<Value>(L:RMI 1 Select, enum) 1 == @Distance 99.9 < && if{ @Distance 10 % s1 9 >= l1 9 - * @ExtDigit(@Distance,3,1) + }</Value>
TIA
