So I've been working on this weapon upgrade system for my game, and it has worked perfectly until it came across my minigun weapon.
The special thing with the minigun is that it can overheat, and when overheating (but not fully overheated) it will do more damage.
The formula for bullet damage for other weapons with the upgrading is as follows:
BulletDamage * (WeaponLevel - 100) ^(1.5 * ((WeaponLevel - 100) / 10) /2)
The "weaponlevel" is always at atleast 100 when usable, and can increase up to 110.
For the overheated minigun bullets, the previous formula was "Overheat / 6". The overheat would never go above 100, and never shoot overheated bullets when below 40.
The new formula for the overheated bullets is:
(Overheat / 6) * (WeaponLevel - 100) ^(1.5 * ((WeaponLevel - 100) / 10) /2)
However, in a few bullets, the damage comes out as "NaN" and when it hits an enemy, the HP of the enemy also becomes "NaN" and it becomes immortal.
Why is this, and how do I fix it?