How do I verify if a number is float

Get help using Construct 2

Post » Sat Oct 29, 2016 6:20 pm

I am making a tool of math, i need help in how to verify if my number is float, if true, i implemment a fractional representation of the number.
B
33
S
9
G
3
Posts: 280
Reputation: 4,297

Post » Sat Oct 29, 2016 6:25 pm

You could check the value of number%1. If it's 0 it's an integer, otherwise it's a float. Alternatively you could convert the number to a string and use a find to see if there's a point in it.
B
101
S
39
G
134
Posts: 5,588
Reputation: 85,514

Post » Sat Oct 29, 2016 9:07 pm

Thanks mate.
B
33
S
9
G
3
Posts: 280
Reputation: 4,297


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 5 guests