Why does MATLAB 7.4 (R2007a) give an erroneous answer using SUM(single(:))?
Afficher commentaires plus anciens
MATLAB gives erronous answers using the SUM function when the dataset is very large. for example:
n=25e6 ;
a=ones(n,1,'single');
b=sum(a(:))
The value of variable 'b' would be 16777216 which is 32% different from the correct answer of 25e6.
If SUM(SUM(a)) was used the discrepancy would not exist.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!