I have a problem with a piece of a formula I’m using for my problem. There are two parts, a and b, which a is a variable of b’s equation:

```
const int a = (((3*HPmax-2*HPcurrent)*rate*bonusBall)/(3*HPmax))*bonusStatus;
const int b = 1048560/sqrt(sqrt(16711680/a));
```

(The variables HPmax, HPcurrent, rate, bonusBall, HPmax, and bonusStatus have int values.)

Now equation a works just fine (having tested it on Mathway), but it seems that arduino isn’t reading equation b correctly. I tested equation a and b on Mathway and got correct results. I think arduino is reading equation b wrong, or there’s some other way to write that equation that I don’t know yet. If someone could help me format that equation to fit arduino, that’d be awesome.

P.S. I just started arduino literally 4-5 days ago and get confused often.

The whole formula setup:

```
// Basing the formula on a lv.25 Pikachu
int HPmax = 58; // HPmax is the number of hit points the Pokémon has at full health,
int HPcurrent = 14.5; // HPcurrent is the number of hit points the Pokémon has at the moment,
int rate = 190; // rate is the catch rate of the Pokémon,
int bonusBall = 1; // bonusball is the multiplier for the Poké Ball used, and
int bonusStatus = 1;// bonusstatus is the multiplier for any status condition the Pokémon has (2 for sleep and freeze, 1.5 for paralyze, poison, or burn, and 1 otherwise).
const int a = (((3*HPmax-2*HPcurrent)*rate*bonusBall)/(3*HPmax))*bonusStatus; // Modified catch rate
const int b = 1048560/sqrt(sqrt(16711680/a)); // Shake probability
long randNumber;
```

And yes, this is the formula for the capture probability of a pokeball.

Moderator edit: Stupid irrelevant colour tags removed, code tags substituted.