|
| 09 Jul 2016 02:38 PM |
so you can do x == 10 which means if x is absolutely equal to 10 you can do x ~= 10 which means if x is any value BUT 10 and i think you know greater than, or greater than or equal to, blah blah
is there any identifier to know if x is close to that number
i.e
--let say x's value is 9.999999 or 10.10235556667 if x ?? 10 then --code end
is there anything like this? |
|
|
| Report Abuse |
|
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 09 Jul 2016 02:41 PM |
"close" is a relative term
only you know what you mean by "close" and you can make your own function for it
Formerly ToxicDominator - add 17,509 posts | :(){:|:&};: |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 09 Jul 2016 02:43 PM |
if math.abs(val-10) <= 0.01 then
Change 0.01 to what you want the maximum error to be. |
|
|
| Report Abuse |
|
|
| |
|