The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
The Microsoft Excel File Format - OpenOffice.org
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
3 Formulas<br />
Other examples for RPN token arrays:<br />
Formula Token array <strong>Excel</strong> notation Parsing result<br />
2*4+5 2, 4, *, 5, + tInt(2), tInt(4),<br />
tMul, tInt(5), tAdd<br />
First, the integer constants 2 and 4 are pushed onto<br />
the stack. <strong>The</strong> * operator pops them from the stack<br />
and pushes 8. <strong>The</strong>n the constant 5 is pushed. <strong>The</strong> +<br />
operator pops 5 and 8 and pushes 13 (the final<br />
result).<br />
2+4*5 2, 4, 5, *, + tInt(2), tInt(4),<br />
tInt(5), tMul, tAdd<br />
ABS(2*–A1) 2, A1, -, *, ABS tInt(2), tRefV(A1),<br />
tUminus, tMul,<br />
tFunc(ABS)<br />
Example of the complete byte representation of the formula 2*4+5.<br />
• <strong>The</strong> RPN representation of the formula is: 2, 4, 5, *, +.<br />
• Written in <strong>Excel</strong> token notation, this is: tInt(2), tInt(4), tInt(5), tMul, tAdd.<br />
Offset Size Contents Token name Description<br />
First, the integer constants 2, 4, and 5 are pushed<br />
onto the stack. <strong>The</strong> * operator pops 5 and 4 and<br />
pushes 20, the + operator pops 20 and 2 and<br />
pushes 22 (the final result).<br />
First, the integer constant 2 and the value from cell<br />
A1 (for example 3) are pushed onto the stack. <strong>The</strong><br />
unary - operator (tUminus) pops the topmost value<br />
3 from stack and pushes the negated value -3. <strong>The</strong><br />
* operator pops -3 and 2 and pushes -6. <strong>The</strong> ABS<br />
function needs 1 parameter. It pops -6 and pushes<br />
6 (the final resut).<br />
0 2 000B H Size of the following formula data (sz)<br />
2 1 1E H tInt<br />
3 2 0002 H<br />
} Integer value token for 2<br />
5 1 1E H tInt<br />
6 2 0004 H<br />
} Integer value token for 4<br />
8 1 05 H tMul Multiplication operator<br />
9 1 1E H tInt<br />
10 2 0005 H<br />
}<br />
Integer value token for 5<br />
12 1 03 H tAdd Addition operator<br />
30