Problem 44971. Convert base 10 to base x (2-16)
Convert input number(s) (cell array of character arrays) in base 10 to base x (2 through 16). Output should be a cell of character arrays. Compute output to a maximum of 50 decimal places.
For example: Convert 1376.5 base 10 into base 2.
answer: {'10101100000.1'}
Solution Stats
Problem Comments
-
9 Comments
Show
6 older comments
Rafael S.T. Vieira
on 26 Oct 2020
Oh, the problem was with my algorithm, sorry. I am indeed using python's long int (for multiplication of large integers), but I was relying on str2num for some operations (which apparently introduced floats back in my code). After removing it, it worked out fine.
PS: This new update knocked out some wrong solutions (including some of mine). Awesome. :)
William
on 23 Apr 2021
In each of test3, test4 and test5, there is a number with a decimal fractional part 0.0962. It appears as thought it was converted in each case as though the fractional part was 0.962.
David Hill
on 30 Jun 2022
Corrected tests 3,4,5. Answers should all be good now.
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
-
967 Solvers
-
17194 Solvers
-
111 Solvers
-
343 Solvers
-
4950 Solvers
More from this Author57
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!