Prev: Fmincon fun and nonlcon functions
Next: how to do this
From: goutham raj on 13 Aug 2010 08:08 i'm in need of converting a decimal number(double datatype) to a binary number. The inbuilt matlab function dec2bin supports only 16bit conversion with no decimal point precision. can't i convert a number greater than 65536(2^16) using matlab?? also pls help me in converting a floating point decimal number to binary... thanks in advance... gouthamraj
From: Jan Simon on 13 Aug 2010 10:02 Dear Goutham, > i'm in need of converting a decimal number(double datatype) to a binary number. Please specify what "binary" number means. Jan
From: Walter Roberson on 13 Aug 2010 10:16 goutham raj wrote: > i'm in need of converting a decimal number(double datatype) to a binary > number. The inbuilt matlab function dec2bin supports only 16bit > conversion with no decimal point precision. can't i convert a number > greater than 65536(2^16) using matlab?? also pls help me in converting a > floating point decimal number to binary... Which version are you using? >> dec2bin(99999) ans = 11000011010011111 >> dec2bin(2^52+1) ans = 10000000000000000000000000000000000000000000000000001 If you want to convert a floating point number to binary, you can start with num2hex() which will convert a single precision or double precision number to the hex representation of IEEE 754 >> num2hex(pi) ans = 400921fb54442d18 In the past I have posted floating point to binary conversion routines (and vice versus)
|
Pages: 1 Prev: Fmincon fun and nonlcon functions Next: how to do this |