-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
149 lines (101 loc) · 3.88 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
PCALC
Programmer's calculator, command line utility.
There was always a loophole when it came to a need to covert between
hexadecimal / decimal / octal / binary.
Especially if it involved an operation like 0x1234 + 0x20
It took a lot of hard work, and mostly a good pocket calculator.
Main features:
o Full math parser, paranthases, add, sub, mult, div, exponential
o Automatic conversion between HEX DEC OCT BIN numbers
o Mixing different bases in one expression
o Definable variables
o Math constants (E PI ...)
o Built in math functions (sin/cos/sqrt ...)
Specification:
Number specification:
0x1234 hexadecimal
0c1234 octal
0y0101 binary
123456 decimal
Built in functions:
sin mathematical sinus
cos mathematical cos
atan mathematical atan
log mathematical log
log10 mathematical log10
exp mathematical exp
sqrt mathematical sqrt
int mathematical int
abs mathematical abs
f2c converting temperature-> fahrenheit to celsius
c2f converting temperature-> celsius to fahrenheit
in2mm converting length-> inches to millimeter
mm2in converting length-> millimeter to inches
po2kg converting mass-> pounds to kilogram
kg2po converting mass-> kilogram to pounds
Built in controls:
echo echo to the screen
_echo echo to the screen, no new line
date echo to the screen, expanding date variables
store store vaiable to file
restore restore vaiable from file
Built in variables:
DEBUG for debug 0=off 1=on
DEC controling number display 0=default 1=dec 2=hex 3=bin
Operator priorities:
LOW '=' assignment
or binary or
and binary and
'>' '<' binary left/right shift
'+' '-' addition/subtruction
'*' '/' '%' multiply/divide/modulus
'-' unary minus
HIGH '^' exponentation
Syntax:
pcalc var
pcalc expr
pcalc number
pcalc var = number
pcalc builtin expr
pcalc builtin ( expr )
pcalc date "string"
pcalc echo "string"
pcalc _echo "string"
pcalc store var
pcalc store var to "file"
pcalc restore var
pcalc restore var from "file"
The result is output in 3 parts:
DEC number HEX number BIN number
20 0x14 0y10100
If the number is out of range from the HEX and BIN numbers, the
truncated numbers are displayed.
Examples:
(see also the ./ptest directory)
--------------------------------------------------------------------------
c:>pcalc 0x300
768 0x300 0y1100000000
--------------------------------------------------------------------------
c:>pcalc '0x300 + 3 * 3'
777 0x309 0y1100001001
Note: shell expansion on the '*' char required the single quote
--------------------------------------------------------------------------
c:>pcalc sqrt 2
1.4142136 0x1 0y1
--------------------------------------------------------------------------
c:>pcalc sqrt(2)
1.4142136 0x1 0y1
--------------------------------------------------------------------------
c:>pcalc 0x12 or 23
23 0x17 0y10111
--------------------------------------------------------------------------
To execute a calculation script from a file, precede the file name with the
character '@'.
Example:
pcalc @pcalc.001
Dirty:
This project was constructed in a 'quick and dirty' scedule, please
forgive missing parts etc ...
Feedback:
Please send email about updates/ports/suggestions to
pcalc-devel@lists.sourceforge.net