浮点形式 | 定点模拟形式 | 备注 |
1.0 | FIXED_1 | #define FIXED_1 (1 << 11) |
e^-5/300 * 1.0 = 0.92 | e^-5/300 * FIXED_1 = 1884 | #define EXP_1 1884 |
avenrun_f[0] * 1.0 | avenrun[0] = avenrun_f[0] * FIXED_1 | |
avenrun_f[0] * 0.92 | avenrun_f[0] * 0.92 * FIXED_1 = avenrun[0] * EXP_1 / FIXED_1 | |
calc_load_tasks * 1.0 | calc_load_tasks * FIXED_1 | active = calc_load_tasks * FIXED_1 |
avenrun[0] * 0.92 + calc_load_tasks * 0.08 | avenrun[0] * EXP_1 / FIXED_1 + active * (FIXED_1 - EXP_1) / FIXED_1 = ( avenrun[0] * EXP_1 + active * (FIXED_1 - EXP_1) ) / FIXED_1 |