Problem with custom damage formula

Not sure if VX Ace forum is the right area for this, but I'm using the VX Ace engine, so I'll try here first.

I'm trying to design a skill that has a successively greater chance to insta-kill the target the further below 50%MHP they are.  The formula I have so far is this:

Spoiler
rand(100) >= (b.hp/b.mhp*200) ? b.add_state(1): a.atk * 2 - b.def
Theoretically, the above should work, but the practical effect appears to be that if the above skill hits anyone not at max health, they die.  The death effect shouldn't even have a chance of happening until the target's health hits 50%.  What am I doing wrong here?
I think it's because it's doing integer check... and b.hp/b.mhp when you have less than 100% HP is always 0 (it results to decimals lower than 1, so it gets rounded to 0) before it gets multiplied by 200... so the result is still 0... 

You should set either b.hp or b.mhp to float so that it will return the decimals before multiplying by 200... so either

set b.hp to b.hp.to_f 

or 

set b.mhp to b.mhp.to_f
Man, I hadn't even considered that RM would round off my numbers before the formula was complete.  That seems to have fixed my issue.  Thanks!
basically, the results are of the same type of the items in the formula... if it's two integers, the result will always be another integer so you need to change one of them to float type if you want it to show decimals... then you could always just change it back to integer after the whole process...
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/problem-with-custom-damage-formula.19537/