# Strange Math Problems

### » Wed Sep 29, 2010 3:36 am

Hi,

I really have a problem with a simple multiplication.

global('m')*(global('n')+1)

where m = 10
and n = 0.85

This should be 10*(0.85+1)=18.5

BUT Construct means 17.65 is the right answer. I have done half of my game and now it hangs on this simple multiplication?

Greetings from the rainy Germany
Michael
B
8
S
3
G
2
Posts: 46
Reputation: 1,592

### » Wed Sep 29, 2010 6:42 am

I am getting 18.5 here.
B
21
S
4
G
4
Posts: 280
Reputation: 2,934

### » Wed Sep 29, 2010 7:25 am

I have testet everything but i am getting 17.65 all the time.
B
8
S
3
G
2
Posts: 46
Reputation: 1,592

### » Wed Sep 29, 2010 9:06 am

I'm getting 18.5 also, can you share the .cap? Or maybe replicate the results in a fresh cap so we can see whats going on?
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

### » Wed Sep 29, 2010 9:39 am

[quote="UnixRoot":3hesvrn1]Hi,

I really have a problem with a simple multiplication.

global('m')*(global('n')+1)

where m = 10
and n = 0.85

This should be 10*(0.85+1)=18.5

BUT Construct means 17.65 is the right answer. I have done half of my game and now it hangs on this simple multiplication?

Greetings from the rainy Germany
Michael[/quote:3hesvrn1]

17.65 would be the answer if m = 9. Perhaps everyone has already noticed that, but I thought I'd throw that out there just in case...
B
36
S
4
G
8
Posts: 67
Reputation: 5,907

### » Wed Sep 29, 2010 9:47 am

[quote="gazoogle":2yxoqim8]17.65 would be the answer if m = 9. Perhaps everyone has already noticed that, but I thought I'd throw that out there just in case...[/quote:2yxoqim8]

Wouldn't the result then be more like 16.65 ?!!

Anyway, for me the calculation comes up right in Construct as well. So a cap from you UnixRoot would help a lot to figure out what's actually going on.

[quote="UnixRoot":2yxoqim8]Greetings from the rainy Germany[/quote:2yxoqim8]
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

### » Wed Sep 29, 2010 12:56 pm

[quote="PixelRebirth":2qdjbwve][quote="gazoogle":2qdjbwve]17.65 would be the answer if m = 9. Perhaps everyone has already noticed that, but I thought I'd throw that out there just in case...[/quote:2qdjbwve]

Wouldn't the result then be more like 16.65 ?!!

Anyway, for me the calculation comes up right in Construct as well. So a cap from you UnixRoot would help a lot to figure out what's actually going on.

[quote="UnixRoot":2qdjbwve]Greetings from the rainy Germany[/quote:2qdjbwve]

oops, I guess what I should have said was 9*.85 + 10 = 17.65
B
36
S
4
G
8
Posts: 67
Reputation: 5,907

### » Wed Sep 29, 2010 4:00 pm

[url:12kr74bm]http://dl.dropbox.com/u/12412965/exp.cap[/url:12kr74bm]

now here is the cap file. I really don't know what to do. Everything would be fine if the global('m') variable will be calculatedlike it should.
B
8
S
3
G
2
Posts: 46
Reputation: 1,592

### » Wed Sep 29, 2010 4:07 pm

Event order does matter. So does the order of your actions. And in event 2 you're changing global 'n' before you calculate 'm', therefore the result appears to be off. Just put the actions in correct order and you're good to go.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

### » Thu Sep 30, 2010 9:38 am

Thank you very much, that solved my problem.

And nice to see that there are some pixelartists on here. I love doing pixelart and retro graphics.
B
8
S
3
G
2
Posts: 46
Reputation: 1,592

Next