# How do I Get rid of Decimals

Get help using Construct 2

### » Sat Aug 09, 2014 10:56 am

Hi have a score system that is bast on how far you come in pixel but that gives me a problem withe decimals
in score is there a way not to diplay decimal?

Thanks
B
13
S
3
G
1
Posts: 36
Reputation: 908

### » Sat Aug 09, 2014 12:17 pm

You mean that you have a number like 100.5? Use action Set text(or what you setting) to floor(ScoreVariable).
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

### » Sat Aug 09, 2014 12:25 pm

It's called float number, use integer.

int(variable)

floor is not integral, it' s opposite of round.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,426

### » Sat Aug 09, 2014 12:33 pm

Joannesalfa wrote:It's called float number, use integer.

int(variable)

floor is not integral, it' s opposite of round.

I was so hurry that just write first that comes to mind
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

### » Sat Aug 09, 2014 12:41 pm

Actually, it's opposite of ceil, not round, floor does round a number downward to its nearest integer.
B
99
S
35
G
29
Posts: 3,139
Reputation: 28,426

### » Sat Aug 09, 2014 4:55 pm

Joannesalfa wrote:Actually, it's opposite of ceil, not round, floor does round a number downward to its nearest integer.

I can't see a real difference between floor and int in that case. int(100.9995) and floor(100.9995) are still 100. So floor can be used too.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

### » Sat Aug 09, 2014 5:06 pm

In this example is the same but int() and floor() are quite different. For example:

floor(-10.7) = -11

int(-10.7) = -10
B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844

### » Sat Aug 09, 2014 5:34 pm

shinkan wrote:In this example is the same but int() and floor() are quite different. For example:

floor(-10.7) = -11

int(-10.7) = -10

Sure, i'm not saying that they are the same, but if op use them for displaying score, that is frequently greater than 0, he can choose between them.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

### » Sat Aug 09, 2014 5:37 pm

Yeah but what if at some point, op will need some negative values?
Now he knows the difference
B
160
S
69
G
44
Posts: 2,611
Reputation: 36,844

### » Sat Aug 09, 2014 5:39 pm

shinkan wrote:Yeah but what if at some point, op will need some negative values?
Now he knows the difference

If so, then he got to use int for sure.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Next