Author Topic: Is there a ROUND function?  (Read 6869 times)

Tags:
  • All members
  • Posts: 68
Is there a ROUND function?
« on: 07 Jan 2013, 15:35 »
I' d like to round up calculated values in a trigger to 2 decimal points.

In a spreadsheet I would use something like "ROUND(1.2345,2)". Which would return 1.23 .

Is there a way to do this in a trigger calculation?

  • Tim Vetrov
  • Administrator
  • Posts: 4905
  • Gender: Male
*
Re: Is there a ROUND function?
« Reply #1 on: 07 Jan 2013, 16:56 »
What do you need this function for?
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 68
Re: Is there a ROUND function?
« Reply #2 on: 07 Jan 2013, 17:14 »
What do you need this function for?

For rounding numbers up or down. i.e. to 2 places 1.79 rounds up to 2 and 1.11 rounds down to 1.

  • Tim Vetrov
  • Administrator
  • Posts: 4905
  • Gender: Male
*
Re: Is there a ROUND function?
« Reply #3 on: 07 Jan 2013, 18:27 »
Yes, I know what's the function for.
I mean what's your aim?
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 68
Re: Is there a ROUND function?
« Reply #4 on: 07 Jan 2013, 19:23 »
Yes, I know what's the function for.
I mean what's your aim?

The aim is that to round bet amounts up or down to the nearest 50 cent.

So when the trigger constants have been used to calculate a bet, and it comes to a strange amount (i.e. 2.3759) the bet will be rounded (i.e. to 2.5 or 2.0)

  • Tim Vetrov
  • Administrator
  • Posts: 4905
  • Gender: Male
*
Re: Is there a ROUND function?
« Reply #5 on: 07 Jan 2013, 20:22 »
INTEGER(my_val) + IF(INTEGER(my_val*100)/100 - INTEGER(my_val) < 0.5, 0, 0.5)
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

  • All members
  • Posts: 68
Re: Is there a ROUND function?
« Reply #6 on: 07 Jan 2013, 20:25 »
INTEGER(my_val) + IF(INTEGER(my_val*100)/100 - INTEGER(my_val) < 0.5, 0, 1)

Thanks for that. It's certainly more complex than the standard spreadsheet ROUND() function though.

Is there a list of supported functions?

  • Tim Vetrov
  • Administrator
  • Posts: 4905
  • Gender: Male
*
Re: Is there a ROUND function?
« Reply #7 on: 08 Jan 2013, 14:50 »
Help -> Triggered Betting -> Reference -> Operators and Functions
Proud to be 🇺🇦
I'm happy to help Monday - Friday, 08:00-18:00 GMT
Буду рад помочь с понедельника по пятницу, 08:00-18:00 GMT

 

Please note, BetFair is seems to be currently OFFLINE