# digits after "."

Get help using Construct 2

### » Wed Nov 09, 2011 11:02 pm

Hi,

I wonder how to have only two (or less/more) digits after a "." (eg. 0.38)

I was thinking I could use "Left" expression, but it couldn't work at all times, eg. for 6digits number as well as a 4digits number...

Is it possible to define the number of digits after a "."?

Thanks for helping
B
42
S
12
G
13
Posts: 628
Reputation: 10,421

### » Wed Nov 09, 2011 11:13 pm

Try: round(N * 100) / 100
for 2 decimal places, or 1000 for 3 decimal places, etc
If your vision so exceeds your ability, then look to something closer.
Moderator
B
117
S
28
G
66
Posts: 4,781
Reputation: 47,069

### » Fri Nov 11, 2011 4:39 pm

It works well ! Thank you guy
B
42
S
12
G
13
Posts: 628
Reputation: 10,421

### » Fri Nov 11, 2011 5:06 pm

Hey, finally, it doesn't work as well as I wish.
eg. when the number is "12.88", it works, but if it's "12.80", the result with the "round" function is "12.8"....

An idea ?
B
42
S
12
G
13
Posts: 628
Reputation: 10,421

### » Sat Nov 12, 2011 6:25 pm

I'm sorry to be insistent, but I didn't figure out this problem.
Somebody would have any idea
B
42
S
12
G
13
Posts: 628
Reputation: 10,421

### » Sat Nov 12, 2011 6:38 pm

Try this for setting text to a number to two decimal places:
int(num) & "." & int(num*100)%100
B
75
S
21
G
48
Posts: 4,671
Reputation: 37,207