Simple Calculator

Posted On 2018-01-27 by RDE
Keywords:
Tags: VB6 Complete Applications VB6 Miscellaneous 
Views: 78

Title Uploaded Size
Calculator.zip 1/27/2018 6:15:13 AM 10,932


Features store/recall/exchange, undo/redo, copy/paste, all vb math operators and vb math functions. The math engine/expression evaluator come from the MS knowledge base article Q86688. Also features tray icon on minimize, drag and drop of form without caption bar, popup options menu with usage info, undo/redo history to twenty levels, auto clear when new expression, always-on-top option and more.

This calculator recognizes the following math functions that you can type directly in or select from the popup menu:

ABS, ATN, COS, EXP, FIX, INT, LOG, RND, SIN, SNG, SQR, and TAN

This calculator recognizes the following operators and sub-expressions, listed by precedence from highest to lowest:

  • Constants, function calls, parentheses
  • Exponentiation ^
  • Unary minus -
  • Multiplication and division *, /
  • Integer division \
  • Integer modulus MOD
  • Addition and subtraction +, -
  • Relational operators =, <>, <, >, <=, >=
  • NOT
  • AND
  • OR
  • XOR
  • EQV
  • IMP

The precedence of unary minus "-" and operator "NOT" indicate the highest possible precedence of their operand. Unary minus and "NOT" may occur in an expression of any precedence.

The following expressions illustrate the precedence rules for unary minus and "NOT".

Expression Value
-1 ^ 2 -1
-(1 ^ 2) -1
(-1) ^ 2 1
2 ^ -2 .25
NOT 0 = 1 -1
NOT (0 = 1) -1
(NOT 0) = 1 0
NOT 0 AND 1 1
(NOT 0) AND 1 1
NOT (0 AND 1) -1


About the Author

RDE has posted a total of 2 articles.


Comments On This Post

No comments on this post yet!


Do you have a thought relating to this post? You can post your comment here. If you have an unrelated question, you can use the Q&A section to ask it.

Or you can drop a note to the administrators if you're not sure where you should post.


Your IP address is:23.20.165.182

Before you can post, you need to prove you are human. If you log in, this test goes away.




Code Links