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

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

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
126
S
29
G
73
Posts: 5,091
Reputation: 52,002

Post » 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: 630
Reputation: 10,985

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

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

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

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

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
85
S
27
G
85
Posts: 5,070
Reputation: 57,874


Return to How do I....?

Who is online

Users browsing this forum: Brice, just2pale, Triforce and 1 guest