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
30
S
9
G
3
Posts: 280
Reputation: 4,212

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
92
S
32
G
106
Posts: 5,272
Reputation: 69,455

Post » Sat Oct 29, 2016 9:07 pm

Thanks mate.
B
30
S
9
G
3
Posts: 280
Reputation: 4,212


Return to How do I....?

Who is online

Users browsing this forum: rayolf, Yahoo [Bot] and 28 guests