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

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
94
S
33
G
113
Posts: 5,357
Reputation: 73,275

Post » Sat Oct 29, 2016 9:07 pm

Thanks mate.
B
32
S
9
G
3
Posts: 280
Reputation: 4,262


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 11 guests