CMath plugin for Take Command / TCC / TCC/LE
Version 1.0.0 2021-10-22
This plugin provides an easy way to evaluate math expressions at the command line. Just type a colon, followed by the expression you want to evaluate, and press Enter.
To use this plugin, copy CMath.dll to some known
location on your hard drive. (If you are using the 32-bit version of Take Command,
take CMath-x86.dll instead of
CMath.dll.) Load the .DLL file with a
PLUGIN /L command, for example:
plugin /l c:\bin\tcmd\test\cmath.dll
If you copy the .DLL file to a subdirectory named PlugIns within your Take Command program directory, CMath will be loaded automatically when TCC starts.
To evaluate a math expression, type a colon followed by the expression. Then press Enter:
The answer, 7, will be displayed below your expression. It will also
be saved to the environment variable
ANS. You can use this
variable in your next expression:
Just remember that
ANS changes every time you use CMath.
After the second line,
ANS will be 14, not 7.
CMath calls the same function that
@EVAL uses internally.
You can use any operator or function that is legal in
You do not need to quote or escape special characters:
:1 << 8
:1024 >> 3
:5 & 9
:5 | 9
:5 ^ 9
The one special character which needs attention is the percent
sign. If you want to use a percent sign as the modulo operator,
you will need to double it. (But it’s probably easier just
:100 mod 7
You do not need a percent sign before environment variables. You do need a percent sign before internal variables and variable functions:
:3 * %@dec[foo]
@EVAL’s built-in functions do not take a percent
:fact(n) / fact(n-r) / fact(r)
The displayed answer will be highlighted. You can customize this
feature by setting an environment variable
rem Disable highlight:
rem Set the highlight foreground:
set highlight=bright cyan
rem Set both foreground and background:
set highlight=bri whi on blu
rem Numbers are also supported:
This plugin displays an informational line when it initializes. The
message will be suppressed in transient or pipe shells. You can disable it
for all shells by defining an environment variable named
set /e /u noloadmsg=1
This plugin is © Copyright 2021, Charles Dye. Unaltered copies of the binary and documentation files may be freely distributed without restriction. I make no guarantee and give no warranty for its operation. If you find a problem, you can report it in the JP Software support forum.