# How to convert floating point decimal to binary

Convert 2.625 to binary.

(d means decimal, b means binary) d is your float. You write 12d in binary and remove it from your float. Only the remainder d) will be left. Feb 09,  · Combine the two parts of the number that have been converted into binary. For instance, the number 85 in binary is and the decimal portion in binary is When you combine them using a decimal point, you end up with as your final answer. %().

Join Stack Overflow to binnary, share floxting, and build your career. Connect and share knowledge within a single location that is structured and easy to search. I would like to write a program that converts a floating point binary number into decimal. I know how to convert a normal binary number into decimal but I would like to convert a floating point binary into decimal with a mantissa of 10 and a exponent ti 6.

At the binwry time I would like to use floatting to gain the binary value e. Is this possible? Stack Overflow for Teams — Collaborate and share knowledge with a private group.

Create a free Team What is Teams? Learn more. Asked 5 years, 6 months ago. Active 5 years, 6 months ago. Viewed times. Improve ninary question. Concerning mantissayou might find this useful. And maybe this and this. And let the confusion begin. Could you give an example in your question what you consider a floating point binary number, a decimal and a binary number? These definitions are ambiguous so it would be goo to know exactly what you mean so it can be answered properly.

There is the definition of the numeric theory and the How to obtain a beer license Language Specification. Add a comment. Active Oldest Votes. Given a String like " Divide the answers. I don't know if there's a simpler way. Improve this answer.

The Overflow Blog. How often do people actually copy and paste from Stack Overflow? Now we know. Podcast One in four visitors to Stack Overflow copies code. Featured on Meta. Stack Overflow for Teams is now free for up to 50 users, forever. New onboarding for review queues. Should the polnt tag be removed? Outdated Answers: results from use-case survey. Downvotes Survey results. Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled.

...and Beyond!

I'm stuck on a homework assignment; I need to convert a binary float to a decimal fraction. I feel like I understand the process, but I'm not getting the right answer. Here's my thought process. I have the binary float: 0 The bias for a 3-bit exponent field . I'm trying to convert a 16 bit precision binary number to decimal format however I am completely failing to do so. The binary I'm trying to convert is \$\$ My current method is: Separation: \$0||\$ Sign = 0. Mantissa = \$\$ Exponent = \$21 - (2^4 - 1) = 6 \$ Mantissa Denormalised = \$\$. Given a String like "", one approach is: Split the string into two bits using likedatingus.com Use the BigInteger constructor BigInteger (String s, int radix) with radix == 2 to get the two BigInteger s representing and Use the BigDecimal constructor taking BigInteger to .

Join Stack Overflow to learn, share knowledge, and build your career. Connect and share knowledge within a single location that is structured and easy to search. I'm stuck on a homework assignment; I need to convert a binary float to a decimal fraction. I feel like I understand the process, but I'm not getting the right answer. Here's my thought process. If my answer is wrong, then I don't understand why, and I'm hoping someone can point me in the right direction.

Wikipedia has a good detailed article on the single-precision float binary32 format, with lots of examples. For binary32 float, the formulas are from the wiki article :. Anyway, with zero exponent, notice that the exponent is no longer expbits - bias , it's one higher.

Then the mantissa is 1. We have two different assignments, one for 7 bit floats and one for 8 bits. I figured I'd start with the 7 bits. The homework doesn't mention anything about different formats; I'm brand new to this stuff, but I know we'll be writing ARM64 instructions later in the semester, I don't know if that makes more sense. Show 4 more comments. Active Oldest Votes. Improve this answer. Peter Cordes Peter Cordes k 34 34 gold badges silver badges bronze badges. Add a comment.