I'm creating a 3D matrix(lat,long,landuse)and trying to calculate the fraction of the landuse for each matrix cell:
One example cell could produce a vector specified by:
fractions=landuse/total_number_of_landuse;
I have to do this for multiple cells and when I do this and sum up the fractions, some are 1 and some are 1.0000.
I know this is due to the floating point "problem".
I have to use these data for a C++-Modell which is checking the sum also and then throws me an error for some of the cells (those which summs up to 1.0000).
I also tried calculating these as double or single.
Any idea how I can make them sum up to 1?
Thanks, Philipp