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
45
S
12
G
13
Posts: 628
Reputation: 10,496

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
122
S
29
G
70
Posts: 4,910
Reputation: 49,506

Post » Fri Nov 11, 2011 4:39 pm

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

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
45
S
12
G
13
Posts: 628
Reputation: 10,496

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
45
S
12
G
13
Posts: 628
Reputation: 10,496

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
82
S
26
G
62
Posts: 4,831
Reputation: 45,202


Return to How do I....?

Who is online

Users browsing this forum: DannyBil, Exabot [Bot] and 0 guests