Consider the following guidelines:
float array[10]; float x = 1.0; int i; for (i = 0; i< 9; i++) { /* No conversions needed */ array[i] = array[i]*x; x = x + 1.0; } for (i = 0; i< 9; i++) { /* Multiple conversions needed */ array[i] = array[i]*i; }
When you must use mixed-mode arithmetic, code the integer and floating-point arithmetic in separate computations whenever possible.
if (error) {handle error} else {real code}should be written as:
if (!error) {real code} else {error}