## Using NoteTab's Calc function.

Expand Messages
• Hi All, I was trying to understand the operators and functions of the Calc function in NoteTab. Some of the listed items are rather cryptic and obscure. I
Message 1 of 1 , Apr 26, 2003
• 0 Attachment
Hi All,

I was trying to understand the operators and functions of the Calc function
in NoteTab. Some of the listed items are rather cryptic and obscure. I
wrote a couple of clips with wizards and Infoboxes to let me see the
results of various calculations using these items and then paste the
results into a document as I wish. Three years ago before I went into the
hospital, I was on the list with others investigating these items to try to
get a more detailed list of how to use them. When I went into the
hospital, the whole thing just got lost. I have decided to try again and
to this end I am reposting the two clips that I wrote as well as a list of
examples of each of the operators and functions being used.

I am not trying to teach or learn math on the list. The purpose is to show
examples of each operator or function in use and possibly to understand how
some of the more obscure functions are or can be used in clip programming.

Here are the clips:

The first clip performs the calculation, displays the result in an infobox,
and stores it in the clipboard for later pasting to a document.

The second clip not only performs the calculation, but also displays and
stores the equation in the clipboard as well.

______[Copy below this line]_______
H="Calc Result Only"
;Larry Thomas <larryt@...>
;04/26/2003, 12:04:23 AM
;
;----------------------[begin long line]---------------------------
^!Set %Equation%=^?{Enter your Equation=} ; %Decimal%=^?{Entter Decimal
Places (Limit is 17)=0|1|_2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17}
;-----------------------[end long line]----------------------------
;
^!SetClipboard ^\$Calc(^%Equation%;^%Decimal%)\$
^!Info ^\$GetClipboard\$
_____[Copy above this line]______
| right click over the clipbook |
| and choose "Add from Clipboard" |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

______[Copy below this line]_______
H="Calc [Equation and Result]"
;Larry Thomas <larryt@...>
;04/26/2003, 12:05:37 AM
;
;----------------------[begin long line]---------------------------
^!Set %Equation%=^?{Enter your Equation=} ; %Decimal%=^?{Entter Decimal
Places (Limit is 17)=0|1|_2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17}
;-----------------------[end long line]----------------------------
;
^!SetClipboard ^%Equation%= ^\$Calc(^%Equation%;^%Decimal%)\$
^!Info ^\$GetClipboard\$
_____[Copy above this line]______
| right click over the clipbook |
| and choose "Add from Clipboard" |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯

You can enter any number of decimal places to be displayed in the result
but the calc function is limited to a maximum of 17 places to the left of
the decimal. After that, it pads the result with zeroes. I would only
place acuracy reliance on the first 13 places. The last two decimal places
are subject to inaccuracies due to program limitations and problems
resulting from conversions between binary and decimal results.

Here are the examples that I did. If anyone reading this has better
information than this, please submit it here. If I am wrong in my
assumptions about any of the items below I would like to get the correct
information. Thank you.

EXAMPLES OF NOTETAB'S MATH OPERATOR AND FUNCTION USAGES:
========================================================

14 + 9 = 23
23 - 9 = 14
7.31 * 16.75 = 122.4425
155.29 / 29.49 = 5.265852831468294
2 ^ 2 = 4.000000000000000 (Squared)
2 ^ (1/2) = 1.414213562373095 (Square Root)
2 ^ 3 = 8 (Cubed)
2 ^ (1/3) = 1.259921049894873 (Cube Root)
91 DIV 17 = 5 (Quotient)
91 MOD 17 = 6 (Remainder)
17 * 5 = 85
85 + 6 = 91

PI = 3.141592653589793
COS(1) = 0.540302305868140
SIN(1) = 0.841470984807897
SINH(1) = 1.175201193643801
COSH(1) = 1.543080634815244
TAN(1) = 1.557407724654902
ARCTAN(1.557407724654902) = 1.000000000000000
COTAN(1) = 0.642092615934331
EXP(1) = 2.718281828459045
LN(2.718281828459045) = 1.000000000000000
LOG10(100) = 2.000000000000000
LOG2(8) = 3.000000000000000
LOGN(3;27) = 3.000000000000000
SQRT(25) = 5.000000000000000
SQR(5) = 25.000000000000000
POWER(2;3) = 8.000000000000000
POWER(2;3.55) = 11.712685567565002
INTPOWER(2;3.55) = 8.000000000000000 (only uses the integer 3)
MIN(53;92) = 53.00
MAX(53;92) = 92.00
MAX(7.512;INT(7.512)) = 7.512000
MIN(7.512;INT(7.512)) = 7.000000
MAX(-7.512;INT(-7.512)) = -7.000000
MIN(-7.512;INT(-7.512)) = -7.512000
MAX(3;-4) = 3.00
MIN(3;-4) = -4.00
ABS(14) = 14.00
ABS(-14) = 14.00
ABS(0) = 0.00
TRUNC(1.59) = 1.00
TRUNC(7.12) = 7.00
INT(1.59) = 1.00
INT(-7.12) = -7.00

ROUND(1.5955*100)/100 = 1.600000 (Rounded up to the nearest cent)
ROUND(1.59112*100)/100 = 1.590000 (Rounded down to the nearest cent)
ROUND(5285/100)*100 = 5300.00 (Rounded up to the nearest hundred)
ROUND(5249/100)*100 = 5200.00 (Rounded down to the nearest hundred)

CEIL rounds the number up from zero to the next integer if it has a
fractional part and it is a positive number. If it is a negative number,
it rounds the number up towards zero to the next integer.
It does not round it if the number does not have a decimal part.

CEIL(7.9112) = 8.000000000000000
CEIL(-7.9112) = -7.000000000000000
CEIL(7.0000001) = 8.000000000000000
CEIL(-7.0000001) = -7.000000000000000
CEIL(7) = 7.000000000000000
CEIL(-7) = -7.000000000000000

FLOOR rounds the number down toward zero to the next integer if it has a
fractional part and it is a positive number. If it is a negative number it
rounds the number down from zero to the next integer.
It makes no change if it does not have a decimal part.

FLOOR(7.9112) = 7.000000000000000
FLOOR(-7.9112) = -8.000000000000000
FLOOR(7.0000001) = 7.000000000000000
FLOOR(-7.0000001) = -8.000000000000000
FLOOR(7) = 7.000000000000000
FLOOR(-7) = -7.000000000000000

You can use HEAV(X) to test for negative numbers.
It returns 0 (False) for a negative number and 1 (True) for all others.

HEAV(0) = 1.00
HEAV(7) = 1.00
HEAV(.0000001) = 1.00
HEAV(-.00059) = 0.00

You can use SIGN(X) in a clip to control the sign of another number.

^!Set %Test%=^\$Calc(SIGN(^%x%)*^%y%;0)\$
If x is greater than zero Test will be equal to y.
If x is zero then Test will be zero.
If x is less than zero then Test will be equal to y with its sign reversed
+/-.

^!Set %Test%=^\$Calc(SIGN(^%x%)*ABS(^%y%);0)\$
If x is greater than zero Test will be equal to y.
If x is zero then Test will be zero.
If x is less than zero Test will be equal to minus y.

SIGN(8) = 1.00
SIGN(0) = 0.00
SIGN(-3) = -1.00

You can use ZERO(X) to test for a non-zero number.
Returns 0 (False) if the number is a zero and 1 (True) if it is not a zero.

ZERO(0) = 0.00
ZERO(-9) = 1.00
ZERO(.0000000000000001) = 1.00

You can use LZERO(X) to test for a zero.
Returns 1 (True) if the number is a zero and 0 (False) if it is not.

LZERO(0) = 1.00
LZERO(-9) = 0.00
LZERO(.0000000000000001) = 0.00

These are random number generators for games and such.

RND(100)-50 = -13.77 (Random number from -50 to +50)
RANDOM(1)+7 = 7.02 (Random number from 7 to 8)
========================================================
END OF THE EXAMPLES OF NOTETAB'S MATH OPERATOR AND FUNCTION USAGES

Regards,

Larry
larryt@...
Your message has been successfully submitted and would be delivered to recipients shortly.