Simple Calculator

By | 2018-01-27

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”.

ExpressionValue
-1 ^ 2-1
-(1 ^ 2)-1
(-1) ^ 21
2 ^ -2.25
NOT 0 = 1-1
NOT (0 = 1)-1
(NOT 0) = 10
NOT 0 AND 11
(NOT 0) AND 11
NOT (0 AND 1)-1

Attachments

FileUploadedSize
925-20180127-061513-Calculator.zip1/27/2018 6:15:13 AM10932
Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.