Hello Guest

Round a variables value

  • 1 Replies
  • 240 Views
*

Voodoohack

  • **
  • 13
  • +0/-0
    • View Profile
Round a variables value
« on: August 01, 2020, 01:36:49 am »
I've tried nextbet = mathfloor(Var, 0.000005) but it doesn't work for some reason :(( help?

*

Seuntjie

  • *****
  • 537
  • +14/-2
    • View Profile
Re: Round a variables value
« Reply #1 on: August 01, 2020, 01:34:11 pm »
For one thing, the syntax is math.floor, not mathfloor. The dot is important.

Secondly, floor rounds DOWN to the closest INTEGER. in other words math.floor(0.999999) will return 0. math.floor(100.99999999) will return 100. So it is doing exactly what it should, just not what you need.

Doing a web search for simply 'lua round' provided this result that seems like a pretty resource: http://lua-users.org/wiki/SimpleRound