Displaying Number of Decimals

For questions about using Classic.

Post » Tue Apr 02, 2013 8:08 pm

Display the number. How would I cutdown on the number of decimals? Like I want to get "5.96000003814967" to like 5.96000"Azu2013-04-02 20:10:32
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Tue Apr 02, 2013 11:34 pm

As a string, just use FormatDecimal, e.g.
FormatDecimal(5.96000003814967, 5) results in the string "5.96000"

If you need to keep a number, multiply by 10^number_of_decimals, floor() it and divide again by 10^number_of_decimals, e.g.
floor(5.96000003814967 * 100) / 100 results in the number 5.96


I answer just because it was a wonderful sunny day with a clear blue sky (the first since almost 4 months), which gave me some extra energy.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Tue Apr 02, 2013 11:58 pm

Thank you very much.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 10 guests