The stupid question is the question not asked | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Thanks! That will save one exponentiation step. Earlier I had to do base^x, base^y, now only one exponentiation step is required (exp(log(y) - log(x))). Btw, range for log(y) - log(x) is (-inf 0] As I came to learn from another source where they CREATE log table for this particular problem (function logmath_init() in http://cmusphinx.svn.sourceforge.net/viewvc/cmusphinx/trunk/sphinxbase/src/libsphinxbase/util/logmath.c?revision=11275&view=markup) It's like this - first set (log(y) - log(x)) = 0; then compute base^(1 + exp(log(y) - log(x)) then decrement log(y) - log(x) by 1 (equivalent to dividing by base) and recomputing base^(1 + exp(log(y) - log(x)) this is done untill we reach the MOST negative number. Using this table one can back-compute any log(x+y) for that particular base. Thanks again for your help. In reply to Re^2: Add numbers in log domain
by pRaNaV
|
|