PCalc
PCalc
PCalc
PCalc

version 1.21
version 1.21
version 1.21
version 1.21

Documentation

# Documentation

For years now I've always wanted a really good programmer-geared calculator; now I'm not just talking about just displaying values in hex or binary or some other format, but I mean one that's JUST like programming (specifically C/C++). Of course, I'm way to impatient to wait for someone else, so I wrote AnalogX PCalc.

AnalogX PCalc is deceptively simply looking, but in reality it's can process complex expressions just like C! You can type in expressions and have it solve them - you can even create variables for more complex operations! So, not only can you do this:

2 + 2

but this:

((2.0 * sin((0.72 * (PI * 2)) / 3.25) + cos(90 * DEG_TO_RAD)) & 0xFF) << 9

or this:

x = 5
y = 13
z = (2 * (x + y))

It should handle all of the standard C math functions with the same parameters and return values. Everything internally is processed as 64bit floats, and then is converted into an int... It's important to not that the conversion is just the straight type change you would normally expect (ie; x = (int)y).

``` Here are the normal operators:          + - * / % =
Here are the assignment operators:      = += -= *= /= %= ~= &= ^= |= >>= <<=
Here are the conditional operators:     > < >= <= == !=
Here are the bitwise operators:         ~ & ^ | << >>
Here are the functions/macros:          floor, ceil, abs, sin, cos, acos, tan, atan, sqrt,
log, ln, exp min, max, rand, and srand
Here are the string functions:          strlen, strcmp, strcmpi
```

There are also several constants already delared, and they are TRUE (1), FALSE (0), PI (3.14159265358979323846), RAD (6.28318530717958647692), DEG_TO_RAD (0.0174532925199433), and RAD_TO_DEG (57.2957795130823). The only other somewhat hidden function is to make the power of something, so for instance 100 or 10^2... Since ^ conflicts with the bitwise operation, instead I use :, so 10:2 will automatically become 100.

You can explicitly declare values as specific type in the following way; 'h' or '0x' or '#' denotes a hex value (like h0F or #3A or 0xF3), 'o' denotes an octal value (like anyone really uses these), '@' denotes an ASCII character (so if you enter @A it translates to 65), or finally 'b' denotes a binary value (like b0010). To make things simple, it displays the results of any operation in all the formats (float, integer, hex, and binary), so you can get a good feel for what's happening. The 'C' button at the end of each result line will copy the line's result into the copy buffer in the same format as whatever the line was.

Using variables is really basic, if you type in:

2+2

the result will display '4'... If you type in:

x = 2+2

the result will still display '4', but now you've created a variable called 'x' which contains the value. Variables are always stored as 64bit floats, so if you want to clamp it like an int, you'll have to explicitly floor() it or and it with the given bitmask necessary. You can also just type the variable by itself and it will return what the variable contains;

If you minimize it, it will show up down on your system tray, so you can quickly pop it open again.