C/C++ NaN resolution -
when i'm running code have add elements of vector , renormalize. i'm getting nan i'm hoping resolve this.
for example, when x = [1,2,3]
vector<double>
compute sum(x) = 6
, find out x/6
setting x[i] = x[i]/sum(x)
in x. problem x typically holds large doubles , when compute sum(x)
(len(x)
large way) nan. how can deal not nan?
changing store long double might work??
have verified vectors not bring nan them? btw - "norm" use not non-negative arbitrary vectors, sure don't want sum abs(x[i])?
Comments
Post a Comment