# 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
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,997

### » 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
145
S
33
G
89
Posts: 5,918
Reputation: 62,601

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

It works well ! Thank you guy
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,997

### » 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 ?
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,997

### » 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
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,997

### » 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
100
S
38
G
134
Posts: 5,556
Reputation: 85,325