logarithm and product, which is faster?# Programming - 葵花宝典t*d2005-11-09 08:111 楼a = log(b*c*d*e*f)ANDa = log(a) + log(b) + log(c) + log(f)Which code is faster?Thx!
a*a2005-11-09 08:112 楼The former is faster, but the other is more stable from overflow.【在 t*d 的大作中提到】: a = log(b*c*d*e*f): AND: a = log(a) + log(b) + log(c) + log(f): Which code is faster?: Thx!
a*e2005-11-09 08:113 楼Modern compilers will consider them the same.【在 t*d 的大作中提到】: a = log(b*c*d*e*f): AND: a = log(a) + log(b) + log(c) + log(f): Which code is faster?: Thx!