[QUOTE=nullsquared;22086309]Try -2^-2 and -2^--2.[/QUOTE]
Whoops, my expression parser used to get 3 for both :S
now:
[code]Hook Main( )
Print( -2^-2 )
Print( -2^2 )
EndHook
--------
-0.25
-4[/code]
I'm not working on some boring parser... I'm working on a physics based racing game!
[img]http://www.cubeupload.com/files/337a00pheesics20100521.gif[/img]
[QUOTE=ZeekyHBomb;22088303][url]http://anyhub.net/file/todofreelyunix.tar.bz2[/url]
Only had to adjust one line and a small helper-class :)
I'm going to contact the author of this program about it.
Not me... :'([/QUOTE]
I wish there was a sympathy rating :(
[QUOTE=Dlaor;22088576]
[img]http://www.cubeupload.com/files/337a00pheesics20100521.gif[/img][/QUOTE]
Damn it! I was hoping it would make it to the end =(
[QUOTE=Chandler;22088583]I wish there was a sympathy rating :([/QUOTE]
[img]http://www.facepunch.com/fp/rating/heart.png[/img]?
[QUOTE=ZeekyHBomb;22088303]I'm going to contact the author of this program about it.[/QUOTE]
I don't think the author is around anymore, since the official website is down and he didn't respond to an e-mail I sent him a few months ago.
[QUOTE=Dlaor;22088576]I'm not working on some boring parser... I'm working on a physics based racing game!
[img]http://www.cubeupload.com/files/337a00pheesics20100521.gif[/img][/QUOTE]
I must say, you've really nailed performance already.
[QUOTE=arienh4;22087915]Parsers are the new projects everyone in this thread are trying.[/QUOTE]
me neither :keke:
I'm still working on [url=http://www.moddb.com/games/rotion]this[/url] game, although I haven't released any media for quite some time. I hope to have a big update somewhere in the next few days, although uploading a video could prove problematic due to bandwidth restrictions :(
[QUOTE=Robert64;22088420]Whoops, my expression parser used to get 3 for both :S
now:
[code]Hook Main( )
Print( -2^-2 )
Print( -2^2 )
EndHook
--------
-0.25
-4[/code][/QUOTE]
Nice :smile: Does it handle -2^--2 (double negation) correctly? :v:
[QUOTE=nullsquared;22089565]Nice :smile: Does it handle -2^--2 (double negation) correctly? :v:[/QUOTE]
Whoops, I had it outputting what it parsed the code as after splitting it up into tokens and simplifying it, the actual code I fed it was:
[code]Hook Main()
Print( -2^-2 )
Print( -2^--2 )
EndHook[/code]
[QUOTE=Robert64;22088420]Whoops, my expression parser used to get 3 for both :S
now:
[code]Hook Main( )
Print( -2^-2 )
Print( -2^2 )
EndHook
--------
-0.25
-4[/code][/QUOTE]
Wait, it's evaluating -2^2 as -4?
Am I the only person who thinks something is wrong here, or have I been lied to since third grade?
[QUOTE=GreyIOutcast;22092164]Wait, it's evaluating -2^2 as -4?
Am I the only person who thinks something is wrong here, or have I been lied to since third grade?[/QUOTE]
It's doing -(2^2), not (-2)^2
[QUOTE=GreyIOutcast;22092164]Wait, it's evaluating -2^2 as -4[/QUOTE]
-2^2 is the same thing as -1 * 2^2
[QUOTE=nullsquared;22092729]-2^2 is the same thing as -1 * 2^2[/QUOTE]
Try (-2)^2 :D
[QUOTE=Dlaor;22088576]I'm not working on some boring parser... I'm working on a physics based racing game!
[img]http://www.cubeupload.com/files/337a00pheesics20100521.gif[/img][/QUOTE]
setting up box2d and creating a few shapes with velocity isn't boring?
[QUOTE=Overv;22083959]Currently this is the interface to add constants and functions:
[cpp]// Set constants
expression.SetConstant( "pi", 3.1415926535897932384626433 );
expression.SetConstant( "e", 2.7182818284590452353602874 );
expression.SetConstant( "phi", 1.6180339887498948482045868 );
// Add functions
expression.SetFunction( "sin", Math.Sin );
expression.SetFunction( "cos", Math.Cos );
expression.SetFunction( "tan", Math.Tan );
expression.SetFunction( "log", Math.Log10 );
expression.SetFunction( "ln", Math.Log );
expression.SetFunction( "sqrt", Math.Sqrt );[/cpp][/QUOTE]
Doesn't look like an interface to me :p
Also, why not do this:
[cpp]
foreach(var kv in new Dictionary<string, double> {
{ "pi", Math.PI },
{ "e", Math.E },
{ "phi", 1.6180339887498948482045868 },
})
expression.SetConstant(kv.Key, kv.Value);
[/cpp]
[QUOTE=efeX;22095328]setting up box2d and creating a few shapes with velocity isn't boring?[/QUOTE]
Yeah that's boring as hell, except that was angular velocity. Which is waaaaay more awesome.
[QUOTE=nullsquared;22092729]-2^2 is the same thing as -1 * 2^2[/QUOTE]
Actually, it's not. -x^2 is the same as x^2, the result will always be positive.
[QUOTE=DrLuke;22101623]Actually, it's not. -x^2 is the same as x^2, the result will always be positive.[/QUOTE]
ax^2 = a(x^2)
(ax)^2 = a^2*x^2
-x^2 = -(x^2)
(-x)^2 = (-1)^2*x^2 = x^2
[QUOTE=TehBigA;22095257]Try (-2)^2 :D[/QUOTE]
[code]Hook Main()
Print( (-2)^2 )
EndHook
Output: 4[/code]
Can anyone give some complicated ones which will test that I have operator preference right? stuff like -2^--2 etc.
[QUOTE=DrLuke;22101623]Actually, it's not. -x^2 is the same as x^2, the result will always be positive.[/QUOTE]
Before you argue about math-related topics, please go review your math skills :downs:
Exponentiation has a higher precedence than negation.
Ugh, why the f*** does Love2D.org go offline every time I want to continue working on my game. Is there some way to download their entire wiki with API reference? I really need offline documentation.
[QUOTE=Clavus;22102366]Ugh, why the f*** does Love2D.org go offline every time I want to continue working on my game. Is there some way to download their entire wiki with API reference? I really need offline documentation.[/QUOTE]
You can download an entire wiki, but it's messy business, and takes up loads of space.
I bet Love2D has downloadable documentation anyway though
I've got some progress done.
I formatted all the information I got and pulled all the info I need out of the shoutbox.
[img]http://img227.imageshack.us/img227/8320/20100522696x337.png[/img]
I still need to do a lot of things...
[QUOTE=Chris220;22102458]You can download an entire wiki, but it's messy business, and takes up loads of space.
I bet Love2D has downloadable documentation anyway though[/QUOTE]
Only of older versions :saddowns:
[QUOTE=nullsquared;22101943]Before you argue about math-related topics, please go review your math skills :downs:
Exponentiation has a higher precedence than negation.[/QUOTE]
Square you, I am used to write x² and then -x² would mean that it's (-x)^2.
-x² is still -(x^2). Only (-x)² is (-x)^2. Whether you write ² or ^2 doesn't matter - you need the parenthesis.
[QUOTE=DrLuke;22103830]Square you, I am used to write x² and then -x² would mean that it's (-x)^2.[/QUOTE]
My graphics calculator says otherwise.
[QUOTE=Clavus;22104068]My graphics calculator says otherwise.[/QUOTE]
What? My graphics calculator does exactly what nullsquared is saying.
Sorry, you need to Log In to post a reply to this thread.