Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Binary for Decimal Numbers
#1
Hello. Am taking a class and we had to convert decimal numbers to binary. While trying to understand the code to do this, I found out that all numbers less than .5, in binary, begin with a 0. While all numbers after .5, including .5, up to .99999 begin with a 1 in binary. Can anyone explain why this is?
Reply
#2
It's called two's compliment arithmetic.
see: https://www.cs.cornell.edu/~tomf/notes/c...scomp.html
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to make this function general to create binary numbers? (many nested for loops) dospina 4 4,403 Jun-24-2020, 04:05 AM
Last Post: deanhystad
  Binary to decimal script ThorOdinson12521 1 1,861 May-19-2020, 04:22 PM
Last Post: ThorOdinson12521
  hex file to binary or pcap to binary baran01 1 5,686 Dec-11-2019, 10:19 PM
Last Post: Larz60+
  Print Numbers starting at 1 vertically with separator for output numbers Pleiades 3 3,720 May-09-2019, 12:19 PM
Last Post: Pleiades
  testing for Decimal w/o importing decimal every time Skaperen 7 4,432 May-06-2019, 10:23 PM
Last Post: Skaperen
  I'm dividing large numbers of about 25 million digits I need to retain decimal format Pleiades 2 3,172 Apr-26-2018, 07:50 AM
Last Post: Pleiades
  Converting Decimal to Binary emerger 1 2,794 Feb-27-2018, 08:06 PM
Last Post: Gribouillis
  Converting an 8-bit binary to decimal WITHOUT the shortcuts EIA 5 6,995 Dec-01-2017, 09:04 AM
Last Post: stranac
  Need Help: Sort of Binary numbers based on 1's present abinashj 5 5,076 Jul-25-2017, 12:23 PM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020