Decimal to Binary (ieee 754)
Afficher commentaires plus anciens
I want to create a code that converts decimal to ieee754. I do not want to use dec2bin so I do not know where to start. I want x to be my decimal number, eb to number of exponent bits and mb for my mantissa. The outputs are the convert value 'q' followed by s, e, m for sign, exponent, mantissa.
function [q, s, e, m,] = GetRepresentationIEEE754(x, eb, mb)
5 commentaires
Geoff Hayes
le 13 Fév 2016
WhatIsMatlab - why are eb and mb variable inputs to your function? Aren't they fixed for IEEE 754 single and double precision formats?
Walter Roberson
le 13 Fév 2016
num2hex() technically does not use dec2bin() :)
WhatIsMatlab-
le 13 Fév 2016
Modifié(e) : WhatIsMatlab-
le 13 Fév 2016
Guillaume
le 13 Fév 2016
Note that I wouldn't call my function conv as that name is already used by matlab for 1d convolution.
A better name would be GetRepresentationIEEE754.
WhatIsMatlab-
le 13 Fév 2016
Modifié(e) : WhatIsMatlab-
le 13 Fév 2016
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Conversion dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!