digits after "."

Get help using Construct 2

Post » 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
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » 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
120
S
28
G
68
Posts: 4,850
Reputation: 48,301

Post » Fri Nov 11, 2011 4:39 pm

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

Post » 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
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » 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
44
S
12
G
13
Posts: 628
Reputation: 10,471

Post » 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
79
S
24
G
54
Posts: 4,754
Reputation: 40,771


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests