Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

decimal to binary conversion

Status
Not open for further replies.

angu

Member level 3
Joined
Nov 5, 2007
Messages
59
Helped
7
Reputation
14
Reaction score
2
Trophy points
1,288
Activity points
1,663
Hi........
I want to convert decimal numbers to binary form in MATLAB.. I used dec2bin(d,k) function to convert it. But it only supprts for numbers less than 2^53. I want conversion for numbers upto 2^64.
I needed this as a part of my project.....So please help me.....or give me any hints.......... please.
Thanks in advance
Angu
 

Hi,

if u use dec2bin(D), where D as a string and it can represent upto 2^52 only. U can't go more than that.

Added after 2 minutes:

Hi,

Matlab can represent an integer upto 2^52 in any base format.
 
Perhaps it is possible to program the conversasion by hand?
 

hi flanello
thank u for ur efforts..
I tried to implement our hand-division method for dec-binary conversion..
but for numbers greater than 2^53 - 1, arithmetic operations wont support........so we cannot do division or modulo division...
If u have any other way to solve this pblm, pls help me
thank u
 

Unfortunately I haven’t matlab available at the moment…..
What operations can you do in matlab with number greater than 2^53 - 1?

Because if you can subtract, you can build your own divison/modulo function with a simple loop.

I now this is not a performant solution....
But I have no better idea at the moment

Added after 11 minutes:

If the handcoded functions works, you can use these functions for the first bits until the remaining number is smaller than 2^53. Then you can use the dec2bin function from matlab.
 

I made a exel spreadsheet a while back to convert binary to decimal and vica versa. At the moment it only extends to 1024. If you still neeed something like this let me know, and I'll extend to whatever it was you required.
 

It sounds like if Matlab doesn't support decimal numbers greater than 2^53, you may need to create a custom data type & the appropriate conversion function.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top