• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How To ?

Status
Not open for further replies.
Level 33
Joined
Mar 27, 2008
Messages
8,035
How to detect a number that is whole value ?
Such as 1 or 2, not 1.4 or 2.5.

Furthermore, how to make it Integer when the final answer is in Real ?

Example:
CasterLevel / 7 = 2.56

I want the system to set the answer to 2, not 3.
How ?

Basically, if that number is not a whole value, it will return to its base value.

Example:
875.985 (base value is 875) = 875
99.999 = (base value is 99) = 99
 
Level 13
Joined
Sep 13, 2010
Messages
550
I don't really get the second question, but if I am right then what you want is already done by warcraft. Use "Conversion - Convert Real to Integer"

It will only keep your base. Like 2.567 -> 2

For the first question, solution is based on the second question:

  • (Real((Integer(YourVar)))) Equal to (==) YourVar
JASS:
if I2R( R2I( number ) ) == number then
     return true // it is a whole number
endif
 
Status
Not open for further replies.
Top