Metalogic Calculator 3.3 now based on wxWidgets! Topic is solved

Do you like to promote your wxWidgets based application or component!? Post it here and let's see what the critics have to say. Also, if you found that ONE wx component the world needs to know about, put it here for future reference.
Post Reply
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Metalogic Calculator 3.3 now based on wxWidgets!

Post by metalogic »

Hi all,
My freeware expression calculator http://www.metalogicsw.com/calculator/ has been ported to wxWidgets.

Please keep in mind that this is just an old very simple project that I wrote way back in college and is definitely not a reflection of my best work. :oops: Still, it does give you the result in dec/hex/oct/bin so developers may find it useful.

I want to put an image on my page "powered by wxWidgets" or something along those lines. I think I've seen that somewhere but can't find it. Just want to promote wxWidgets (and encourage everyone else to do so).

Enjoy!
leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio »

The community link on www.wxwidgets.org has the icon, and asks to spread the word with that image.
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Thanks leio.
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Looks very nice :-)
What do you use for formula parsing?

- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Jorg wrote:Looks very nice :-)
Thanks!
Jorg wrote:What do you use for formula parsing?
I wrote the parser myself. :idea:
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Cool .. :-) a parser freak like me .. hehe
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

:D
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

i do direct substitution for my parser :roll: expression goes in, recurse the thing and solve it bit by bit... and the result is substituted to the source expression...
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Yes, I do the same thing. Parse the expression string into a token list. Then as I solve each set of operands, I substitute them for one result token and so on.
Great minds think alike :)

The hardest thing is to figure out the operator precedence, especially when you throw parenthesis in the mix.
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

my RDP works like this:

Variable add/remove? If yes -> handle vars
No -> Add/Subtract
Add/Subtract calls multiply/div before evauluating
multiply/div calls powers before evaulating
powers call functions (sin, tan, acos etc) before evulating
functions call brackets before evaulating
brackets call variable substitution before evaulation
variable substitution call parser intuition before evaulation
then it works its way out...

brackets are a nice case, they just make another parser instance with the expression inside the brackets, and it goes on... and on.... until the deepest bracket is evulated. so my parser obeys the rules of operations lol, (), then ^, then */ and finally +-, i figured that functions come before powers... so yea... and when there are operators of equal precedence the parser will go LTR... like humans would :P
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Yes, about the same here except that I never got around to adding support for functions into my parser. I guess it wouldn't be a huge addition but I really don't maintain this project much anymore. In fact, I hadn't touched it in over a year until I decided to port it to Visual C++/wxWidgets (from Borland C++ Builder/VCL).

So, since you seem to have done a lot of the same work, I have a question for you. One of my biggest struggles was decimal floating point. When doing calculators or financial applications, binary floating point (float, double) is not accurate enough. I struggled to find a free decimal floating point library for C++ but couldn't. So I had to resort to some ugly hack.

How did you solve this? Or did you stick to binary floating point?

For anyone unfamiliar with the problems of binary floating point, here's some info:
http://www2.hursley.ibm.com/decimal/dec ... ml#inexact
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

i use apfloat for the thing, i added a preferences panel entry for parser precision, which defaults to 32 sugnificant figures. I wrote all the math functions (ok, most of it) myself...
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

and of course, if you wanted to have that error minimised pass /Op to VC for better floating pt precision...
metalogic
Super wx Problem Solver
Super wx Problem Solver
Posts: 307
Joined: Fri Oct 08, 2004 8:21 am
Location: Area 51
Contact:

Post by metalogic »

Thanks for the info lowjoel. I will take a look at apfloat when I have some time.

For the time being though, what I'm using works quite nicely. I use the Variant/Decimal data type. That is a 128 bit decimal floating point which is perfect for my purposes.

My only problem with it is that it ties my otherwise mostly cross platform project to Windows. That's why I'd like a better solution.

I did make sure to encapsulate the implementation of my decimal data type so that if I were to swap out data types, my program wouldn't have to change (other than the "wrapper" of course).

Of course, since I'm in no hurry to change this, I might just wait until the decimal128 data type is added to standard C++
http://www.open-std.org/jtc1/sc22/wg21/ ... n1839.html
lowjoel
Part Of The Furniture
Part Of The Furniture
Posts: 1511
Joined: Sun Jun 19, 2005 11:37 am
Location: Singapore
Contact:

Post by lowjoel »

lol, std C++ has some issues to solve.. lol
Post Reply