Notices


Reply
Thread Tools
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#1
I were looking for programmer calculator for N900 for a long time. I found a lot of drawing calculators, simple calculators, complex math/symbolic calculators, RPN calculators, real world calculator emulators etc, etc, etc...

But none of them could show me number in hex/oct/bin (not to tell about floating point numbers in any other numeral system but decimal), and none of them could do bitwise operations on numbers (and it is really critical feature for me, as I have to work with bit-masks from time to time in my practice).

So I asked myself: “Am I a programmer or what?” And here it is: meet procalc, a programmer's calculator. It is in extras-devel and my garage already (https://garage.maemo.org/projects/procalc/).

It features hex/oct/bin/dec numbers representations (including floating point numbers), bitwise operations (and, or, xor, not, and not), complex numbers support, configured precision and three main view modes:

- normal to see numbers as usual,
- raw number view to give insight on inner machine numbers representation (all numbers are converted to unsigned 64-bit integers as bit-streams, so you can even see how double precision floats are presented in separate bits),
- exponential (or “scientific” as it's sometimes called), with numbers formatted as mantissa and exponent.

It is essentially an RPN calculator with a stack, but it can understand normal infix notation (it emulates it by sorting operators and numbers on stack according operations precedence), so you can use it as usual calculator if you don't touch stack control buttons at all.

As seeing is believing, screenshots are attached to this post.

Some key combinations:

1. It doesn't stop you from entering numbers in selected numeral system only (the one selected in main menu affect numbers display in stack and evaluation results representation only). To enter number in other numeral system but decimal, use "Mod+#" combinations, where # can be 2 for binary, 8 for octal or 16 for hexadecimal numbers, use "Mod+0" to go back to decimal input.

2. "C" is "Clear" input, "Fn+C" ("CA") is "Clear All" (both input and stack). "<<" and ">>" is bit shifts, "xBn" is to enter "e" for exponential numbers input, "Mod+xBn" ("+bj") is to enter "j" as postfix to designate imaginary part of complex number.

"Mod" also turns main arithmetic operation keys into statistics operators "σ" (standard deviation), "μ" (mean), "Π" (product), "gμ" (geometric mean) and "Σ" (summa). These operations work on whole stack, so to calculate sum of a set of numbers just push them onto empty stack one by one, push "Mod++" operation and hit "Execute" ("=" button).

3. Almost all onscreen keys have keyboard bindings.

All top row is for numbers input, Ctrl switches on Fn, backspace is a backspace and equal sign/comma/semicolon is for "=" button (a.k.a. "Execute").

Hexadecimal numbers "A"-"F" are uppercase keyboard buttons (i.e. press "Shift+A" to enter "A", "Shift+B" to enter "B" etc). Underscore (_) switches number sign to +/-, and dot (.) is for decimal point.

Star (* or letter "a"), plus (+ or letter "s"), minus (- or letter "f") and slash (/ or letter "v") are for multiplication, addition, substruction and division. Hash (# or "d"), ampersand (& or "k"), exclamation (! or "l"), letter "z" and dollar sign ($ or "x") are for XOR, AND, NOT, OR and AND NOT bitwise operations.

Parenthesis (letters "h" and "j") are for push and pop. Enter is for "=" ("Execute"). Backslash (letter "b") is for power, space is for push. "m" letter switches "Mod" button. "c" letter is for "Clear".

That's all for now. Maybe I have forgotten some details, as I am as developer know all this calculator's functions too well to understand they are unknown to end user, so if you have any questions feel free to ask them. Bug reports and feature requests are wellcome as well.

Project links:
Garage - https://garage.maemo.org/projects/procalc/,
GitHub - https://github.com/kstep/procalc/,
Ohloh - https://www.ohloh.net/p/procalc/.
Attached Images
     
 

The Following 29 Users Say Thank You to kstep For This Useful Post:
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#2
ProCalc is written to get some rest of my other project dbuscron. ProCalc, being still in alpha state, is logically finished with features, so I'm going to keep it in this state for a while until some todo list is filled with tasks and work on dbuscron, so wait for new dbuscron release.
 
Posts: 1,522 | Thanked: 392 times | Joined on Jul 2010 @ São Paulo, Brazil
#3
Lemme know when it hits the repos please
 

The Following User Says Thank You to TiagoTiago For This Useful Post:
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#4
It is in extras-devel already.
 
Posts: 1,522 | Thanked: 392 times | Joined on Jul 2010 @ São Paulo, Brazil
#5
Oh, cool! I had gotten the impression it was still only avaiable by direct download, i'll go install it now, thanx
 
epage's Avatar
Posts: 1,684 | Thanked: 1,562 times | Joined on Jun 2008 @ Austin, TX
#6
FYI ejpi includes octal, hex, and decimal conversions as well as bitwise operations. If you sadly don't abandon and convert over to ejpi , here some some UI features that I think work out well for you to steal.

The various bases, octal, hex, and decimal, are not modes in imitation of handheld calculators like most computer-based calculators. Numbers are either converted to a base or directly entered in as a certain base. After that the base is preserved through any integer-based operation. I think when you do ops with two bases, I prefer the RHS's base.

ejpi has 2 columns, equation and result. This works really well with the above base preservation because you can enter "10" and hit "-> hex" and you will have "hex(10)" in one column and "0xa" in another. I like this one because it is easy for me to forget what I was doing.

The other main feature (though not a programming specific one) is the history is editable (on maemo it is limited to duplicating and deleting).

The current downside is that when I ported to Qt from GTK/Hildon, I dropped showing select pie menu icons on the pie buttons so it takes playing around to find where all the operators are.

http://wiki.maemo.org/Ejpi
(The version in extras-devel and maybe now in extras-testing looks a lot nicer and now has a portrait mode through Ctrl+o)
__________________
770, n810, n900, Ideapad S10-3t
TheOneRing, DialCentral, Gonvert, Quicknote, Multilist, ejpi, nQa, Waters of Shiloah
Programming Blog
 
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#7
Thank you for directions.

Of cause, I took a look at this calculator before, but I found it's interface counter-intuitive. It took me a lot of time to find bitwise "not", and once I found it, it takes me 3 clicks to do it (switch from numbers tab to bitwise-ops tab, click and hold "or", click "not") instead of one click. I see almost the same issue is *standard* arithmetic operations. And I can't just press backspace to delete last number, I have to put focus in input field first. I don't think it is usable, sorry. Although it's my IMHO.

As for
The various bases, octal, hex, and decimal, are not modes in imitation of handheld calculators like most computer-based calculators.
It is true for my calculator as well. Pressing "Mod+2", for example, is the same as switching to 3rd tab in ejpi and clicking "0b" button.

And it has one big drawback for me: I can't see floating point numbers in any other numeral system but decimal (but this drawback have almost all calculators I have seen).

The difference between ejpi and procalc is in philosophy: procalc does not "convert" numbers from one numeral system to another (it stores all numbers as integers/floats/complex on the stack), it just *represents* numbers in different formats according user settings. All the stack at once. What is more convenient is for you to decide.

What about history… Well, the history in case of RPN calculator can be just a series of stack snapshots, so I think I will implement it a little later.
 
epage's Avatar
Posts: 1,684 | Thanked: 1,562 times | Joined on Jun 2008 @ Austin, TX
#8
Originally Posted by kstep View Post
Thank you for directions.

Of cause, I took a look at this calculator before, but I found it's interface counter-intuitive. It took me a lot of time to find bitwise "not", and once I found it, it takes me 3 clicks to do it (switch from numbers tab to bitwise-ops tab, click and hold "or", click "not") instead of one click. I see almost the same issue is *standard* arithmetic operations. And I can't just press backspace to delete last number, I have to put focus in input field first. I don't think it is usable, sorry. Although it's my IMHO..
ejpi was mostly an experiment in UI ideas for computer and specifically touch calculators inspired by a planet.gnome.org post about how computer calculators emulate pocket calculators including all of the limitations. I've actually found the experiment kind of cool and use it for the rare times I need a calculator.

The pie menus are a mixed blessing, mostly the discoverability being an issue. Note that you don't need to click-hold-drag. That is really just for discovery. You just drag and you get it.

Another major downside is the use of tabs. This tends to be a general problem though with any calculator that has too many functions for what is on the screen. I'm not too sure what is the best way to handle this. Maybe instead of tabs, popup the alternate keyboards and have them auto-hide on function press? Maybe numbers available on random pies on all tabs?
I've been forgetting to put numbers (though not as accessible) on the programming tab.

Originally Posted by kstep View Post
As for It is true for my calculator as well. Pressing "Mod+2", for example, is the same as switching to 3rd tab in ejpi and clicking "0b" button.

And it has one big drawback for me: I can't see floating point numbers in any other numeral system but decimal (but this drawback have almost all calculators I have seen).

The difference between ejpi and procalc is in philosophy: procalc does not "convert" numbers from one numeral system to another (it stores all numbers as integers/floats/complex on the stack), it just *represents* numbers in different formats according user settings. All the stack at once. What is more convenient is for you to decide.

What about history… Well, the history in case of RPN calculator can be just a series of stack snapshots, so I think I will implement it a little later.
I think l there might have been a communication gap here. It sounds like your calculator is modal for number base but that you can enter a number as any base. This way of handling bases is what I was contrasting ejpi against. I've found it much more natural as I've used it.
__________________
770, n810, n900, Ideapad S10-3t
TheOneRing, DialCentral, Gonvert, Quicknote, Multilist, ejpi, nQa, Waters of Shiloah
Programming Blog
 

The Following 2 Users Say Thank You to epage For This Useful Post:
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#9
Thanks everybody for advices, patience and support. I (proudly) announce version 0.3.1 (in extras-devel already).

There're a bunch of features to announce, among them (+ additions, - deletions, * fixes):

+ trigonometry and logarithm functions,
+ pi and e constants,
* fixed operations sorting algorithm to emulate infix operations correctly (modified shunting yard algorithm is used),
+ internationalization support (Russian and English locales are available for now),
+ two autoorientation modes: "Automatic (slider)" switches according slider position only, and "Automatic (accel)" uses accelerometer to set orientation,
+ autobase mode (according epage's advice, if I got him correctly at the end): the calculator's base is set to last base used to enter number.

And many other small tweaks and fixes.

I hope you'll like it!

Bugreports, advices and other feedback are wellcome as always.
 
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#10
And yes, I've forgotten to mention list mode for statistical functions. Start list on stack by pushing "list marker" ("Fn+xBn", or "list" button) and push as many numbers on the stack as you like. The next statistic operations executed will consume only numbers up to this marker, no other number on the stack below this marker will be touched.

"Mod" discovers trigonometry and logarithm functions, "Mod+Fn" - reverse trigonometry, "Fn" - hyperbolic functions and modulus (%).
 
Reply


 
Forum Jump


All times are GMT. The time now is 08:47.