You need to test to make sure there is a value in the fields first.
Using FormCalc:
if (HasValue(field1) and HasValue(field2)) then
$ = field1 / field2 * 100
endif
Or JavaScript:
if (!field1.isNull && !field2.isNull) {
this.rawValue = field1.rawValue / field2.rawValue * 100;
}