File: README

package info (click to toggle)
wcalc 2.2.2-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 2,228 kB
  • ctags: 698
  • sloc: ansic: 6,918; objc: 1,835; sh: 766; yacc: 644; lex: 573; makefile: 78
file content (144 lines) | stat: -rw-r--r-- 6,382 bytes parent folder | download
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
Hello!

This is Wcalc 2.2.2!

1. What's New
2. Intro
3. Installation
4. License
5. Known Bugs
6. Contact Info

**************
* What's New *
**************

FEATURES:
 - Inspector is now a panel, rather than a drawer (GUI)
 - Can copy from the history/variable list (GUI)
 - Hexadecimal exponents can now be expressed with an @ symbol (BOTH)
 - Added preference to turn off live precision sliding (GUI)
 - Added preference to change mod (%) behavior (BOTH)

BUGFIXES:
 - Corrected some UI inconsistencies (GUI)
 - Corrected the 0.9e-9 bug (allow negative exponents now) (BOTH)
 - Make mod (%) efficient (BOTH)
 - Improved detection of readline history (CLI)
 - Removed negative zero display (BOTH)
 - Fixed several small memory leaks (BOTH)

*********
* INTRO *
*********

Wcalc started as a project written for my C++ class at Ohio University (CS 240B), way back on January 14th, 2000. I made it to be a "natural language" calculator - in that it would successfully interpret any valid mathematical expression. As you can imagine, being a beginner programmer, the code was rather heinous, to say the least!

I reworked it after learning lex and yacc (powerful string parsing tools for C programmers - if you're a C programmer and you don't know them... go google!) in November 2001. Then I thought to myself - I have MacOS X, the standard calculator leaves something to be desired, and they say Cocoa programming is easy... what the heck, I'll give it a shot. Wcalc has turned out better than I thought it would - so I'm putting it on the web, for you! (If you're curious, yes, Cocoa is as wonderful as they say.)

I keep refining and adding to its capabilities - both the GUI/Cocoa version and the command line version (they use the same innards). I think I may personally use the command line version more frequently, but both are excellent (I have fun with the GUI).

Wcalc takes "expressions" and calculates the answer. My goal was to make the expressions relatively intutive - no reverse polish, or anything like that. So, by way of a record, here is what Wcalc can do:

**********
* Syntax *
**********

Wcalc recognizes the following symbols:
+ (plus)
- (minus)
* (multiply)
/ (divide)
% (modulo (read: the remainder when integers are divided))
! (factorial or boolean NOT)
^ (exponent. four squared is 4^2)
> (less than)
< (greater than)
<= (less than or equal to)
>= (greater than or equal to)
== (equal)
!= (not equal)
&& (logical and)
|| (logical or)
<< (bitshift left)
>> (bitshift right)
| (bitwise or)
~ (bitwise not)
& (bitwise and)

Wcalc also allows you to group operations with parenthesis (), brackets [], and braces {}.

Wcalc supports the following functions:
sin cos tan cot asin acos atan acot
sinh cosh tanh coth asinh acosh atanh acoth
log ln logtwo round abs ceil floor sqrt cbrt comp
Gamma lnGamma zeta sinc

Wcalc has a few built-in constants:
e pi Na k Cc ec R G g Me Mp Mn Md u amu c h mu0 epsilon0
muB muN b ao F Vm NAk eV sigma alpha gamma re Kj Rk Rinf
Eh Gf Mmu Mt Mh Malpha n0 c1 c2 G0 Phi0 K
random irandom rand irand

Wcalc supports user-defined variables. You define a variable like this:
mynewvariable=5
Then you can use it in an expression like this: 1+3*mynewvariable/4

You can also define "active" variables. In the GUI, just type an expression into the appropriate spot of the variable list. In the command-line, when you assign a variable, put it in single-quotes, like this:
twicepreviousanswer='a * 2'
In expressions, these work just like regular variables, except the value is calculated when it's used, not when it's defined.

Some special notes about variables - two things are reserved:
a - this variable represents the last answer, and may be used in expressions.
q - this variable is reserved in the command-line version (it means quit), and cannot be used in expressions.
Also, built-in constants cannot be re-defined, although they are treated as variables in all other cases.

*********
* Bases *
*********

When you type a number into Wcalc, the number is normally assumed to be in decimal form. However, if the number has a prefix, it may be interpreted as a different form number. Specifically:

0x - this means "the following is a hexadecimal"
0 - this means "the following is octal"
0b - this means "the following is binary"

This prefix affects only the number it prefixes, and none of the other numbers in the expression.

Answers are, by default, displayed in decimal form. This can be changed in the preferences window - and display of the prefixes can be toggled in the preferences window as well. You can also change the display using the \hex, \oct, \bin, or \dec commands.

You can, however, print a number in any base (without a prefix) by using the \base command.

****************
* Installation *
****************

Installing the regular (GUI) version of Wcalc is easy - copy it to your Applications folder! To install the command-line version on OSX, use the .pkg file.

For people who may install and use Wcalc on other Unix systems, there are other packages available for download. The source for Wcalc is available on SourceForge from the Wcalc home page, and some RPM packages are available as well. Install as you would usually install from source or from RPM. If you're really new to this sort of thing, there's some information in the INSTALL file.

***********
* License *
***********

Wcalc is made available under the GNU Public License (GPL), version 2. The full text of the License is in the file titled COPYING as distributed with the source, or is available here:
http://www.gnu.org/copyleft/gpl.html

The general gist of the GPL is this: This program is free. You may do as you like with it, including sell the binaries, as long as you don't modify the program or use it as part of another program. If, however, you download the source code of this program and either modify the source (and give it to people) or use pieces of the source in your own program (and give THAT to people), you must distribute that program and its source code under the GPL as well.

**************
* Known Bugs *
**************

The grammar has too many shift/reduce conflicts.
Leaks memory when there's a parse error.

If you find more bugs, please LET ME KNOW!

****************
* Contact Info *
****************

The Wcalc homepage is http://w-calc.sourceforge.net/

Contact me at kyle-wcalc-sf@memoryhole.net