Assault soldiers can pick a perk that lets them fire their weapon twice at a -15 penalty to aim. When is it better to use this ability and when to use regular fire instead?
At 30% normal accuracy (15% with rapid fire), the two will do the same amount of damage, on average. At 29% normal accuracy, a normal attack will do more. At 31% accuracy, a rapid fire attack will do more.
Assuming you do 10 damage per hit:
Here is a spreadsheet where I did the calculations.
If your regular chance to hit is 34% or greater (19% for Rapid Fire), it is always better to use Rapid Fire. The chance to hit at least once while rapid firing with regular accuracy at 34% is 1-(1-0.34-0.15)2=0.3439 or 34%. The chance to hit twice is only 0.0361 or 3.61% under those conditions. Using Rapid Fire at lower accuracy leads to a decreased chance to hit at least once, but the potential for hitting twice may make it worthwhile if the alternative is to let a strong enemy have a chance to attack.
According to Invader Skoodge's graph, both options will do the same damage at 30% accuracy, and above that Rapid Fire will get progressively stronger. Therefore, if your target can be killed in 1 shot, use Rapid Fire if your accuracy is 34% or more, if the target can't be killed in 1 shot, Rapid Fire is viable at accuracy as low as 30%.
One circumstance where you may want to abstain from using Rapid Fire is when your soldier may not have enough ammo to last through the engagement. Note that you will not waste ammo if the target dies on the first shot.