Can I change the type of MATLAB data value from scientific notation to decimal?
Afficher commentaires plus anciens
I need to pass in a variable to a CUDAKernel, but the MATLAB variable is stored in the form "4.324230984e-7" and CUDA is changing this value to something else. Is there a workaround for this? I tried sprintf, but it tells me CUDA is only allowed to take in numerical, logical or gpuArray types.
3 commentaires
Guillaume
le 30 Juil 2018
Your question shows a complete lack of understanding of how numbers are stored on a computer. I suggest that you start by reading about that. The way a number is displayed and how it is stored is completed different.
"to something else"
That's a bit vague! To what?
" I tried sprintf"
Try entering the letters 'T', 'E', 'N' in your calculator and see how that goes. character strings and numbers are two completely different things.
What's missing from your question is description of what you're trying to do and why you think there's a problem.
Walter Roberson
le 30 Juil 2018
Please do not close questions that have an Answer.
Walter Roberson
le 30 Juil 2018
Ishita Korde comments
Question was unclear and unrelated to MATLAB issues. Resolved.
Réponses (1)
Walter Roberson
le 30 Juil 2018
0 votes
MATLAB does not store data in the form you indicate. It stores data as IEEE 754 Double Precision or IEEE 754 Single Precision.
My research indicates that cuda 2.0 and later follows ieee 754. Note though that it is not necessarily the case that cuda uses the same byte order (though evidence is suggestive that it is)
Catégories
En savoir plus sur GPU Computing 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!