1.8.0 Thyme expression error

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

1.8.0 Thyme expression error

Postby Kilinich » Tue Oct 05, 2010 9:29 am

1.8.0

Algodoo failed to calculate unnecessary code

> [0,1](0) == 0 ? 1 : (1/0)
-- Warning: Failed to evaluate: [0, 1](0) == 0 ? 1 : (1 / 0), Division by zero

> [0,1](0) == 0 ? 1 : (0)
1
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: 1.8.0 Thyme expression error

Postby tatt61880 » Tue Oct 05, 2010 2:18 pm

Kilinich wrote:1.8.0

Algodoo failed to calculate unnecessary code

> [0,1](0) == 0 ? 1 : (1/0)
-- Warning: Failed to evaluate: [0, 1](0) == 0 ? 1 : (1 / 0), Division by zero

> [0,1](0) == 0 ? 1 : (0)
1


The code need a set of {}. (I sometimes forget these {}. :D)

Good code:
condition ? {true case} : {false case}

Fail code:
condition ? true case : false case

Next code doesn't fail to calculate. ;)
Code: Select all
[0,1](0) == 0 ? {1} : {(1/0)}
NOTE: I'm not an Algoryx member.
Hi, Algodoo lovers. Have you read next topic? Featured scenes suggestions
To translators: English.cfg changelog will be useful (even for me).
User avatar
tatt61880
[Most Helpful Person 2010]
 
Posts: 1150
Joined: Mon Aug 31, 2009 5:45 pm
Location: Tokyo, Japan

Re: 1.8.0 Thyme expression error

Postby Kilinich » Tue Oct 05, 2010 3:43 pm

I know that workaround, but it must work without {} too imho.

> 0 == 0 ? 4/2 : 1/1
2
> 0 == 0 ? 4/2 : 1/0
-- Warning: Caught exception: Division by zero, Source\script\Expressions.cpp:190: class SharedPtr<class script::Object> script::CodeBlock::Evaluate(class SharedPtr<class script::Reflected>,const class script::Settings &)
-- Warning: Failed to evaluate: 0 == 0 ? 4 / 2 : 1 / 0, Division by zero
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: 1.8.0 Thyme expression error

Postby ags131 » Mon Apr 25, 2011 7:24 am

I noticed that bug too..... (It almost ALWAYS executes false if no {} are used.)
ags131
 
Posts: 71
Joined: Thu Oct 29, 2009 4:14 pm

Re: 1.8.0 Thyme expression error

Postby Sonic » Mon Apr 25, 2011 8:27 pm

Bump much?
I do stuff and break things. You know how it is.
Image
User avatar
Sonic
 
Posts: 1467
Joined: Tue Sep 01, 2009 6:18 pm
Location: America!!!

Re: 1.8.0 Thyme expression error

Postby Someone Else » Mon Apr 25, 2011 10:23 pm

I always use braces around all parts of the IF statement. Partly because it might make things a bit more reliable, partly because it is simply easier to comprehend.

But yeah, this was a pretty useless bump.
Matthias Wandel is epic, in my humble opinion.
I love my brain...
TC42 wrote:Also, your sig is too big, please change it.

ARE YA HAPPY NOW?????

Thymechanic/Phundamentalist

Recently, I discovered something a lot of you probably already knew: Minecraft is awesome.
Due to this, I may not be as active as usual for a while.
User avatar
Someone Else
 
Posts: 1147
Joined: Sun Nov 21, 2010 10:53 pm
Location: The Milky Way Galaxy

Re: 1.8.0 Thyme expression error

Postby emilk » Tue Aug 23, 2011 11:08 am

use {}. This is just how Thyme work.
Emil Ernerfeldt, lead developer
emilk
 
Posts: 616
Joined: Mon Aug 31, 2009 11:01 am
Location: Umeå, Sweden

Re: 1.8.0 Thyme expression error

Postby Kilinich » Tue Aug 23, 2011 12:42 pm

ok np
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests