Metalogic Calculator 3.3 now based on wxWidgets! Topic is solved
-
- 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!
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. 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!
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. 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!
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
-
- Can't get richer than this
- Posts: 802
- Joined: Mon Dec 27, 2004 10:46 am
- Location: Estonia, Tallinn
- Contact:
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/
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/
Looks very nice
What do you use for formula parsing?
- Jorgen
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
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
Thanks!Jorg wrote:Looks very nice
I wrote the parser myself.Jorg wrote:What do you use for formula parsing?
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
Cool .. a parser freak like me .. hehe
- Jorgen
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
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.
Great minds think alike
The hardest thing is to figure out the operator precedence, especially when you throw parenthesis in the mix.
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
-
- Part Of The Furniture
- Posts: 1511
- Joined: Sun Jun 19, 2005 11:37 am
- Location: Singapore
- Contact:
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
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
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
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
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
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com
-
- Super wx Problem Solver
- Posts: 307
- Joined: Fri Oct 08, 2004 8:21 am
- Location: Area 51
- Contact:
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
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
- Santiago
http://www.metalogicsw.com
http://www.metalogicsw.com