Author Topic: absolutely critical that you play with this small stand alone app  (Read 10681 times)

0 Members and 1 Guest are viewing this topic.

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
absolutely critical that you play with this small stand alone app
[edit]new build, handles negitive numbers and beter evaluation[/edit]
http://dynamic4.gamespy.com/~freespace/forums/attachment.php?s=&postid=666534

if you care at all about anything you will run this program and try to break it, you enter any normal mathematical expression (no trig or other type functions yet, just +-*/^) it will evaluate it corectly, if it fails to do so post here describeing what the conditions of failure were (post your expression) I am only going to get two hours of sleep because I stayed up all night working on this FOR YOU the least you could do is test the hell out of it for fifteen minutes. this is for the material and other systems (wouldn't you like user defined variables for the HUD?) it is a simple ugly looking thing but it is crucal that it works flawlessly
testitestittestittestittestitNOWWWW

instructions:
enter a simple (just arithmitic no log or trig (ect...) functions I do intend on implementing them eventualy but not just now) math formula, you may use any number includeing multi-diget and containing decimal points parenthises(ect...), it doesn't quite handle negitive numbers yet but it will.
hit enter
use a calculator to see if it was right.
tell me what happened, whatever the case.

if your not sure weather or not something is suported, try it! godamit!
I realy hope that when I wake up in 2 hours that there's like 40 posts here and not like... none, like there probly will be...
sleep.........

[edit]new build, handles negitive numbers and beter evaluation[/edit]
http://dynamic4.gamespy.com/~freespace/forums/attachment.php?s=&postid=666534
« Last Edit: April 29, 2005, 01:35:06 am by 57 »
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
absolutely critical that you play with this small stand alone app
Awesome. :) I'll definitely test this tomorrow.
-C

 

Offline Ypoknons

  • Ancient
  • 28
    • http://www.xwaupgrade.com
absolutely critical that you play with this small stand alone app
When I download it I get a PHP file.

Firefox doesn't read that.
Long time ago, you see, there was this thing called the VBB and... oh, nevermind.

 
absolutely critical that you play with this small stand alone app
(49*49-49)+((3+3)/3):  Result 2448
(2401-49)+(6/3)
2352+2=2354.




(200/30+20):  Result 6.66667
(200/30)+20)
6.6667 + 20 = 26.6667

10*10+20:  Result 100
50/5+50/10:  Result 10

Also, if you have any two operands together, or if you start an equation with an operand, it crashes the program.  So entering:
+20  causes a crash as does entering 20+/10.
« Last Edit: April 27, 2005, 04:30:59 am by 2338 »

 

Offline Col. Fishguts

  • voodoo doll
  • 211
absolutely critical that you play with this small stand alone app
Tested it and it told me that

(1+2)*2+2 = 6

the last "2" isn't evaluated for some reason.
"I don't think that people accept the fact that life doesn't make sense. I think it makes people terribly uncomfortable. It seems like religion and myth were invented against that, trying to make sense out of it." - D. Lynch

Visit The Babylon Project, now also with HTL flavour  ¦ GTB Rhea

 

Offline gonz

  • 23
absolutely critical that you play with this small stand alone app
3/2*3/2 = 2.25
3*2/3 = 2
2*3/2 = 3
3*2*1 = 6
3+2+1 = 6
3*1*1 = 3
3/1/1 = 3
3+1/2 = 3.5
3-(3+1)/2 = 1
3-(3+1)/2+1 = 2
(2+1)*(2+2) = 12
(2+1)*(2+2)-1 = 12 Incorrect
((2+1)+3)*2 = 12
2^2 = 4
2+2^3 = 10
(2+1)^2 = 9
(2+2)^(3-1) = 16
(3+2)/(3-1) = 2.5
(2.5+0.5)*2 = 6
(2.5+.5)*2 = 6

Note the incorrect result above, pretty good basis for a numerical parser/evaluator. Hope you can work out the bugs.

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
absolutely critical that you play with this small stand alone app
0/5 = 0


Is this really correct?
I think there this shouldn't have any result...

You should get some kind of error if you try to divide 0 with 0.


Everything else I tried worked perfectly. ;)
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline Col. Fishguts

  • voodoo doll
  • 211
absolutely critical that you play with this small stand alone app
Quote
Originally posted by DaBrain
0/5 = 0


Is this really correct?
I think there this shouldn't have any result...


Yes, that's correct, since it's equivalent to 0 * 1/5

Quote

You should get some kind of error if you try to divide 0 with 0.


Correct again, and Bob's program gives INF back, when you divide by 0.
"I don't think that people accept the fact that life doesn't make sense. I think it makes people terribly uncomfortable. It seems like religion and myth were invented against that, trying to make sense out of it." - D. Lynch

Visit The Babylon Project, now also with HTL flavour  ¦ GTB Rhea

 

Offline DaBrain

  • Screensniper
  • 212
    • Shadows of Lylat board
absolutely critical that you play with this small stand alone app
Ah, right... Looks like I deserve the mark I got in math... ;)
--------------------------------------------------
SoL is looking for a sound effect artist
Please PM me in case you want to apply
---------------------------------
Shadows of Lylat - A Freespace 2 total conversion
(hosted by Game-Warden)
----------------------------------

 

Offline tom

  • 25
absolutely critical that you play with this small stand alone app
Quote

Quote


You should get some kind of error if you try to divide 0 with 0.
Correct again, and Bob's program gives INF back, when you divide by 0. [/B]

0/0 = indefinite
I presume the prog calculates that properly.

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
absolutely critical that you play with this small stand alone app
huh... looks like it doesn't handle higherlevel opperations before lower level ones (ie if you * before you - without parenthises around the * block, it will perform the following subtraction incorectly)
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Inquisitor

absolutely critical that you play with this small stand alone app
Aren't there math libraries you could use?
No signature.

 

Offline krisvek

  • 25
absolutely critical that you play with this small stand alone app
Quote
   huh... looks like it doesn't handle higherlevel opperations before lower level ones (ie if you * before you - without parenthises around the * block, it will perform the following subtraction incorectly)


that should be pretty easy to fix though, right?  just throw in a loop checking for the higher levels first

oh, and i couldnt get the thing (firefox), else i'd have run it some too...lemme try with IE

 

Offline krisvek

  • 25
absolutely critical that you play with this small stand alone app
ok, i looked a little deeper into one of the Incorrect problems above...

(2+1)*(2+2)-1 = 12     Incorrect

(2+1)-1 = 2                  Correct

2*(2)-1 = 4                  Incorrect

2*2-1 = 4                    Incorrect

2*2-1+2 = 4                Incorrect

(2*2)-1 = 3                  Correct


So...yeah, that's odd.

 

Offline redmenace

  • 211
absolutely critical that you play with this small stand alone app
Quote
Originally posted by Inquisitor
Aren't there math libraries you could use?

I think this is a school project that involve trees IIRC back to the days of Data Structures.
Government is the great fiction through which everybody endeavors to live at the expense of everybody else.
              -Frederic Bastiat

 
absolutely critical that you play with this small stand alone app
2^2*2+2=4 MAJOR WRONG

Even if it fubars the operator priority, it should work left-to-right, correct? Then it should do:
2^2*2+2
4*2+2
8+2
10

Also, note in whatever documentation that it wants points, and not commas. (EU vs US rules, or Dutch vs English)

15+5*5=40, nice and correct. (Ergo, it does seem to do some kind of operator preference.)

5*5+15=25.

(5*5)+15=40. So it works well with brackets.

It also exits without error on any NAN entry.


2*4+7=8. Pretty wrong. It seems that if you do x*y+z you will always get something odd. Perhaps it gives you just x*y, and forgets z.

Yup, it does. x*y+z gives you x*y.
Also seems x/y-z gives you x/y.
z+x*y gives you a correct answer. (z+(x*y)).
z-x/y gives you z-(x/y), correct as well.

3^-5 gives an ugly crash. (Want the MS bugreport? Msn at [email protected] )
Seems to reproduce for x^-y.
Ditto for x^(-1*y).
However, x^(y-z), when z>y, works, and gives a correct answer.

BTW, can you make it so it'll take an expression as command line arg, and return the result? I could write a testing thing with random expressions in no time.

I'll test some more after dinner, but an argument thingy would be great.

EDIT: Got source? I might be able to read the C and find the bug, if you'd allow a total beginner to touch the code.....
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

 
absolutely critical that you play with this small stand alone app
Also, if I type 1.23456789 I get 1.23457. It seems to round after the 6th decimal, but it rounds correctly.

The only way to create a negative number is to do (1-2)*x, where x is your number.

9\3=9
9/3=3
I know I used the wrong slash, but it might be better to die more graciously.

It seems that if it does not recognise an operator, it returns the value of anything in front of the unknown operator, and ignores the rest. An error return/debug output should be in place to prevent the really odd bugs. (x+y=z gives x+y). It does check for odd stuff at the start of an expression, just not for odd stuff inside the expression.

The ! is not implemented yet.
In the final implentation, e, pi, and any other constants should be replaced by the apropriate value, something that shouldn't be forgotten.

Also, mashing a lot  of keys and adding a few ^operators returns 1.#INF. Anything above 2^127 returns that, actually. Might be worth to add that to docs too. I geuss you're using signed floats, and anything out of bounds is called infinite?

(1-2)*2^127 works as expected.
just another newbie without any modding, FREDding or real programming experience

you haven't learned masochism until you've tried to read a Microsoft help file.  -- Goober5000
I've got 2 drug-addict syblings and one alcoholic whore. And I'm a ****ing sociopath --an0n
You cannot defeat Windows through strength alone. Only patience, a lot of good luck, and a sledgehammer will do the job. --StratComm

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
absolutely critical that you play with this small stand alone app
Quote
Originally posted by Inquisitor
Aren't there math libraries you could use?


I don't think so. What Bobb's trying to implement (correct me if I'm wrong) is what I described for the HUD system, but never got working. The idea was to allow one-line equations to be used to control variables on the HUD. That wayyou could combine variables for a variety of gauges. Say if you wanted a HP gauge, you use the variable "self.hull_strength". If you want a HP % gauge, you use "self.hull_strength / self.total_hull_strength * 100". That way, coders only need to define a base set of variables and modders can combine them any way they please.
-C

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
absolutely critical that you play with this small stand alone app
2^3/4 = 8
2^3/2 = 8
2^3/20 = 8
(2^3)/4 = 2
8*6+3 = 48
8*6+90 = 48
(8*6)+3 = 51
-C

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
absolutely critical that you play with this small stand alone app
there is now a new build up, I will be trying all the expressions the last one failed, I'm fairly sure this is at the least better than the last build, it has a totaly reworked expression parser.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together