Problem 511. Converting Decimal to Binary
Given a decimal number that may include a fractional component, convert it into binary representation. The numbers you are given will always be cleanly representable using positive and negative powers of 2.
As with dec2bin, return your result in a string.
Examples:
Input d = 2.5 Output b is '10.1'
Input d = 34.125 Output b is '100010.001'
Solution Stats
Problem Comments
-
2 Comments
@bmtran (Bryant Tran)
on 20 Mar 2012
If you really want help with this problem, put together a small test suite that gives some inputs and some sample outputs (that you tabulate by hand) and wait for someone to produce a MATLAB function to do what you want.
Ned Gulley
on 20 Mar 2012
This is an interesting problem. Acting as an administrator, I cleaned it up and added some tests.
Solution Comments
Show commentsGroup

Card Games
- 18 Problems
- 25 Finishers
- Card Game
- SET (the card game)
- Poker Series 01: isStraightFlush
- Mongean Shuffle : 2
- Mongean Shuffle
- Combine Cards to make 21
- Poker Card Deal!
- Clock Solitaire
- SET (the card game)
- Poker Series 11: selectBestHand
- Poker Series 10: bestHand
- Poker Series 09: IsHighCard
- Poker Series 08: IsPair
- Poker Series 07: IsTwoPair
- Poker Series 06: isThreeKind
- Poker Series 05: isStraight
- Poker Series 04: isFlush
- Poker Series 03: isFullHouse
- Poker Series 02: isQuads
- Poker Series 01: isStraightFlush
Problem Recent Solvers72
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!