Author Topic: % Mod operator not working  (Read 1905 times)

Tags:
  • All members
  • Posts: 10
% Mod operator not working
« on: 19 Feb 2018, 04:20 »
Hi

The % operator is not working.

When I test it in the User Variables 
balance % 5

I get 1000%5 not a number.

Using it to add "change" (less than a minimum bet) to the next bet.

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: % Mod operator not working
« Reply #1 on: 19 Feb 2018, 06:50 »
hi
sorry but balance%5 is not a formula.
to get 5% of your balance you would have    (balance/100)*5
the 5 is the percent that you want so if you want more or less percent then alter the 5 only.

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: % Mod operator not working
« Reply #2 on: 19 Feb 2018, 06:54 »
Hi thanks for that.

I am actually looking for the Modulus not 5% as per page 159, 8.4.8 of the manual. (% modulus or remainder. For example, 5 % 4 = 1, 36 % 6=0, 23 % 7 = 2)

So Australian Minimum Bet is $5. So if Balance = 103.50, Balance % 5 would equal 3.50 (so I can add $3.50 on to $5 for a total bet of $8.50)

  • Élite
  • Posts: 3698
  • Gender: Male
*
Re: % Mod operator not working
« Reply #3 on: 19 Feb 2018, 08:08 »
hi
sorry i never use the % modulus , only seems to work with round numbers not 103.50.
but if you need to use it i have come up with a formula that will give the correct result.
(integer(balance))%5+balance-(integer(balance))

first it rounds the number then does the % modulus calculation then adds the .xx value.

mcbee
Please read the following  disclaimer with regards to the information you may request and obtain on our forum. This specifically concerns trigger files and various instructions as to how to implement a strategy.

  • All members
  • Posts: 10
Re: % Mod operator not working
« Reply #4 on: 19 Feb 2018, 08:11 »
Thanks for that.

  • Administrator
  • Posts: 8821
  • Gender: Female
*
Re: % Mod operator not working
« Reply #5 on: 20 Feb 2018, 08:44 »
Hello!

Mcbee is right, the modulo operator only works with integer numbers.
Always try your triggers in Test Mode before switching to real money!

Follow us on Twitter.

Join our WhatsApp chat!

Присоединяйтесь к официальному Telegram-каналу!

 

Please note, BetFair is seems to be currently OFFLINE