What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plug-Ins » Calulator Plugin

Pages: (3): « First « 1 2 [ 3 ] Last »
Calulator Plugin
Author: Message:
lhunath
Full Member
***

Avatar
.{ Lord Daisy }.

Posts: 343
40 / Male / –
Joined: May 2004
RE: Calulator Plugin
Looks complex ;)
{ -[Image: lhunath.gif]- }
09-14-2004 04:10 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Calulator Plugin
( 6 + 4 ) * 10 has 7 important tokens.
6 4 + 10 * has five important tokens.
Taking into account the stack-implentation of RPN, it is slightly simpler, especially from a program's POV.
* RaceProUK may use Reverse Polish for any maths questions on his next exam...
[Image: spartaafk.png]
09-14-2004 04:12 PM
Profile PM Web Find Quote Report
aNILEator
Skinning Contest Winner
*****

Avatar
...in the wake of the aNILEator

Posts: 3718
Reputation: 90
35 / Male / Flag
Joined: Oct 2003
Status: Away
RE: Calulator Plugin
i don't see whats wrong with createing a quick text /calc
to be a /run link to the MS calculator
09-14-2004 04:26 PM
Profile PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Calulator Plugin
quote:
Originally posted by Orkblutt
/xcalc 666/77*8
=1.08                             ==> FALSE !!!

/xcalc (666/77)*8          ==> TRUE !!!
=69.20
That makes me wonder how you do the calculation and what method you use... because first of all in many language of today there is already an evaluation function for such things (dunno about C++ though). If you use that, you only need to pass the string and you would never have problems like that....

If you do seperate the numbers yourself then, again, this is some basic flaw in your algorithm, as it would be very easy to do such things in a home-made function:

* use a recursive function
* get the deepest linked parenthesis
* calculate the result of that:
  "*" and "/" coming first, then "+" and "-"
  Also calculate from LEFT to RIGHT!!! <== the error you made ( * or / doesn't take precedence over each other, just like + and - doesnt....)
    1) 666 / 77
    2) 8.64 * 8
  not:
    1) 77 * 8
    2) 666 / 616

* update the "string"
* exit the function and go up 1 level

This is a realy realy basic way in doing it (without optimazations), and you would never have a problem with parenthesis...

note about using "-": it is best that you don't implement substractions, but only additions! If a minus is used, it should be considered part of the number, not a math-function. If you do this you also wont have problems with: "8 - 5" because your function would calculate "8 + -5", but most importantly, you can do "8 * -5" without any additional coding...


So... I'm realy interested in the method you use...

PS:
http://www.codeproject.com/cpp/FastMathParser.asp
http://www.codeproject.com/cpp/RPNcalculator.asp
http://www.programmersheaven.com/zone3/cat415/30915.htm
http://www.informit.com/articles/article.asp?p=21484
http://trubetskoy1.narod.ru/english/ppne.html <= implement this and you also have a PPN calculator...

This post was edited on 09-14-2004 at 06:02 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
09-14-2004 05:15 PM
Profile PM Find Quote Report
Orkblutt
Junior Member
**

Avatar

Posts: 74
Joined: Aug 2004
O.P. RE: Calulator Plugin
quote:
That makes me wonder how you do the calculation and what functions you use... because in most language of today (VB, C++, etc... ) there is already an evaluation function for such things. If you use that, you only need to pass the string and you would never have problems like that....


C++, VB do that ?

quote:
note about using "-": it is best that you don't implement substractions, but only additions! If a minus is used, it should be considered part of the number, not a math-function. If you do this you also wont have problems with: "8 - 5" because your function would calculate "8 + -5", but most importantly, you can do "8 * -5" without any additional coding...

have you test mine ? :)

quote:
So... I'm realy interested in the method you use...


humm it's a little bit complex to explain (I'm too bad in english!!)

Using a little more advanced parser tree method  than http://www.informit.com/articles/article.asp?p=21484 but it's the same principle...

This post was edited on 09-14-2004 at 06:41 PM by Orkblutt.
09-14-2004 05:55 PM
Profile E-Mail PM Find Quote Report
MessEnGer
Full Member
***

Avatar
mess the world

Posts: 169
41 / Male / –
Joined: Jun 2004
RE: Calulator Plugin
Hey nice plugin works great

P.S. srry for the earlier confusion

This post was edited on 09-14-2004 at 10:41 PM by MessEnGer.
09-14-2004 06:21 PM
Profile PM Find Quote Report
Millenium_edition
Veteran Member
*****

Avatar

Posts: 1787
Reputation: 57
Joined: Apr 2003
RE: Calulator Plugin
you don't need to register it.
09-14-2004 06:35 PM
Profile E-Mail PM Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: Calulator Plugin
quote:
Originally posted by CookieRevised
http://trubetskoy1.narod.ru/english/ppne.html
This is probably the best of the links, as it describes an algorithm for converting infix to RPN, which you can then evaluate. That way, users can use the familiar infix, and you can implement the simpler RPN calculator.
[Image: spartaafk.png]
09-14-2004 07:29 PM
Profile PM Web Find Quote Report
Orkblutt
Junior Member
**

Avatar

Posts: 74
Joined: Aug 2004
O.P. RE: Calulator Plugin
thank you!
I'll see if it's necessary to use RPN (if I've too more difficulties with Infix)
thanks for this link
09-14-2004 09:58 PM
Profile E-Mail PM Find Quote Report
Pages: (3): « First « 1 2 [ 3 ] Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On