# Showing numbers to 1 decimal point

Get help using Construct 2

### » Fri Nov 23, 2012 3:17 am

Is there a way to do this? I want to always show 1 decimal point after my number, including when it's 1.0 for example. I know I can do Int(Number*10)/10 to get 1.1, 1.2 etc, which limits it to 1 decimal point only but if the original number was 1.0, it'll just return '1' as the answer.

So for 1 I want to show 1.0
For 1.1 I want to show 1.1
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

### » Fri Nov 23, 2012 4:04 am

Try a forum search for "decimal" and you find the solution:
http://www.scirra.com/forum/format-to-2-decimal-places_topic57060.html

For 1 instead of 2 decimals you can do:
str(int(VALUE))&"."&int(VALUE*10)%10

or if you want the decimals to round up:
str(int(VALUE))&"."&round(VALUE*10)%10Nimtrix2012-11-23 04:13:04
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

### » Fri Nov 23, 2012 4:31 am

Thanks, I'd never have worked this out on my own :)
B
25
S
5
G
3
Posts: 446
Reputation: 5,633