What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Release] Calculator (v1.20.011)

Pages: (5): « First « 1 2 3 4 [ 5 ] Last »
[Release] Calculator (v1.20.011)
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Pre-Release] Calculator
quote:
Originally posted by Mattike
Now, I'll have to make the negative numbers work... (Smilie) (e.g.: h-A)
That doesn't exists.... That is, if you follow programming logic.

If you follow the math logic they do exist, but be EXTREMELY carefull in what you do, this is far from easy to implement this in the correct way.

Look at how a real scientific calculator works with numbers in another base to get the idea on how to implement it properly...

eg: -128 in hexadecimal can be hFF81, hFFFFFF81,  hFFFFFFFFFFFFFF81 etc... convert that back and you could get hFF81 = 65409, hFFFFFF81 = 4294967169, etc. It depends not only on what method you use, but also on the amount of bits/bytes you use to define a hexadecimal/octal/binary number, etc...

My advise would be to not allow negative numbers in other bases than the decimal base.


This post was edited on 10-03-2006 at 06:58 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-03-2006 06:40 PM
Profile PM Find Quote Report
Shondoit
Full Member
***

Avatar
Hmm, Just Me...

Posts: 227
Reputation: 15
35 / Male / Flag
Joined: Jul 2006
RE: [Pre-Release] Calculator
For the functionality
Something like:
-hF*hF + h100 = h1
(It's no problem if this it implemented, is it?)

But he already got it to work...
My scripts:                            [Image: shondoit.gif]
+ Timezone
+ Camelo
+ Multisearch
10-03-2006 06:44 PM
Profile PM Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: [Pre-Release] Calculator
quote:
Originally posted by Shondoit
For the functionality
Something like:
-hF*hF + h100 = h1
(It's no problem if this it implemented, is it?)

But he already got it to work...

it depends on what you mean with the negative sign. Normally a negative sign is part of the number (negative number) if used alone, not part of the calculation. Hence why you shouldn't do: -hF and interpret that as:
- convert hF to 15
- make 15 negative

The "make x negative" should come before "convert x to y", not before! Hence why negative hexadecimal/octal/binary numbers don't exist.

A hexadecimal number produces a negative decimal number if that hexadecimal number wraps around the edge you have defined for the hexadecimal environment.

If you want -15 in hexadecimal it should be hFE or hFFFE or hFFFFFFFE or hFFFFFFFFFFFFFFFE, depending on the range...

btw: "-hF*hF + h100 = h1" is wrong, it should be "h1F"

----------------

To give a better example of why you can't do all that: you will find it even more complex when you're dealing with floating points. Again, you can't do "hF.EF" as that does not exist, almost the same goes for the use of the sign.

----------------

(can't explain this too well, someone else?)
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-03-2006 06:56 PM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. RE: [Pre-Release] Calculator
Oh damn... then I guess I better remove the negative support. :(

Thanks for mentioning, Cookie. I think I'll start on one of the hardest parts of the script: the Help window, since it has to give lots of information. At least I can't break any programming logic with that. 8-)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
10-04-2006 07:57 AM
Profile E-Mail PM Web Find Quote Report
phalanxii
Full Member
***


Posts: 146
Reputation: 5
32 / Male / Flag
Joined: Aug 2006
Status: Away
RE: [Pre-Release] Calculator
Blah, these were driving me a little mad... *-)

1. The F5 calculate works even if it is disabled. (Not that I don't use it :D)
2. Inverse trigonometry functions don't work. (Debug says "! Out of stack space") Fixed this one by removing this line (I think it causes a sort of loop):
code:
if (/^Math\.(a(?:sin|cos|tan2?))\((.+)\)$/.test(Token)) {
   var Func = "Math." + RegExp.$1 + "(" + RegExp.$2 + ")/Math.PI";
   if (/^degrees?$/i.test(Angle)){
      Token = Func + "*180";
   } else if (/^grad$/i.test(Angle)) {
      Token = Func + "*200";
   }
   Token = Token.Calculate();
}
3. Negative functions? (Not subtraction, but expressions beginning with "-Sin(1.5)" or "-Pi"; don't need this too desperately because "0-Pi" works)
4. Hexadecimal "not a number" is "NAN" as opposed to "NaN" in other bases.

Besides that, everything seems fine. (Y) Really helpful for maths homework. :)

This post was edited on 10-05-2006 at 10:59 AM by phalanxii.
10-05-2006 10:27 AM
Profile PM Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. RE: [Pre-Release] Calculator
quote:
Originally posted by phalanxii
1. The F5 calculate works even if it is disabled. (Not that I don't use it :D)
That's what you have with pre-releases: the creator only tests what he thinks he needs to test... doh! :P
quote:
Originally posted by phalanxii
2. Inverse trigonometry functions don't work. (Debug says "! Out of stack space") Fixed this one by removing this line (I think it causes a sort of loop):
code:
if (/^Math\.(a(?:sin|cos|tan2?))\((.+)\)$/.test(Token)) {
   var Func = "Math." + RegExp.$1 + "(" + RegExp.$2 + ")/Math.PI";
   if (/^degrees?$/i.test(Angle)){
      Token = Func + "*180";
   } else if (/^grad$/i.test(Angle)) {
      Token = Func + "*200";
   }
   Token = Token.Calculate();
}

Hmm... strange, but if that can fix it...
quote:
Originally posted by phalanxii
3. Negative functions? (Not subtraction, but expressions beginning with "-Sin(1.5)" or "-Pi"; don't need this too desperately because "0-Pi" works)
Well, here I go again with another attempt for negative values! :D
quote:
4. Hexadecimal "not a number" is "NAN" as opposed to "NaN" in other bases.
Yeh, I wanted to show the hexadecimal values in capital letters, but it seems like I have to run a check for it first. 8-)
quote:
Besides that, everything seems fine. (Y) Really helpful for maths homework. :)
Heh... I guess that's why they requested this script. :P
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
10-05-2006 05:54 PM
Profile E-Mail PM Web Find Quote Report
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
31 / Male / Flag
Joined: Apr 2004
O.P. RE: [Release] Calculator (v1.20.011)
BUMP! Calculator 1.20.011 released and waiting for scripting database to update it. I hope they won't get mad that the update comes 2 hours too late... :(

Please check the first post for information. :)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
12-20-2006 10:16 AM
Profile E-Mail PM Web Find Quote Report
Plan-1130
Full Member
***

I keep askin' myself: why?

Posts: 142
73 / Male / –
Joined: Feb 2005
RE: [Release] Calculator (v1.20.011)
How about inline calculations? Like (!CALC=8*5) or something...
Since you have the engine, and we have Regular expressions, it shouldn't be too hard i guess?
Still, congratulations on such an advanced plugin :D
My Scripts: UltimatFlooder, Advanced PSM Chat, PlusPrivacy, PlusRemote

[Image: Plan-1130.png]
02-09-2008 04:43 PM
Profile E-Mail PM Find Quote Report
Pages: (5): « First « 1 2 3 4 [ 5 ] 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