Actually this is really odd - the output of calcIrms() should never be negative - looking at the code the only way this might happening is if readVCC() returns a negative value (it ought to return the Vcc voltage in millivolts). Looking at the code in readVCC() suggests it is measuring the internal 1.1V reference voltage w.r.t. the supply voltage - I presume you aren't doing anything strange with the AREF pin?