# calculate one value greater than another by 300%

I am trying to write a calculation for a program code but cannot figure out how the math would work. My goal is to have a calculation that would read something like value A is greater than value b by 300% or more.

I know this is a mathematics forum but if it helps the code is in python and would be an if statement like:

if value a is greater than value b by 300% or more then violation, else not a violation.

-
sorry about my bad explanation, im having trouble putting it into words how i need it and am trying to avoid programming language specific stuff, been a while since i had a math class –  wondergoat77 Sep 19 '12 at 17:00
$300\%$ of $b$? So for example, if $b=3$, do you want $a$ at most $3+9=12$? –  David Mitra Sep 19 '12 at 17:21

if b*3<a then
...
else
...


This will check if a is 3 times larger than b since $a*300\% = a*3$.

-
This is checking if $b$ is $300\%$ of $a$, not whether it is $300\%$ more than $a$. Sometimes people are not careful about the wording and what you do may be what OP intended. –  Ross Millikan Sep 19 '12 at 17:35
thanks, this did the trick. –  wondergoat77 Sep 19 '12 at 18:00
When we say a percentage like 300% what we really mean is 3*(100%). You would just take the value of $b$ (which is 100%) and multiply it by 3 and then add that to $b$. In Python this would look something like this:
if a >= 3*b+b:

Yes, 400% of $b$ is 300% more than $b$. In other words if a store has a 30% off sale, you pay $price-.3*price$, and not $.3*price$. –  Noah Klein Sep 19 '12 at 17:43