Divide by 2
#1

Hello,

I want to divide a number by 2 but if it became a float after this operation, i'd like to use floatround how i can so check if the result of operation is a float or not
Reply
#2

It won't become a float. All types must be known compile-time, otherwise you'll get an compiler warning of tag mismatch. So, if you divide tagless variable by tagless variable, you'll get tagless result with fraction part discarded: 5 / 2 == 2. If at least one side of operations is a float, then you'll get a float: 5 / 2.0 == 2.5. So, if you do:
pawn Код:
new result = 5 / 2.0;
You'll get a tag mismatch.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)