Floating point in Assembly

Reply

Join Date: Nov 2008
Posts: 3
Reputation: ombadboy is an unknown quantity at this point 
Solved Threads: 0
ombadboy ombadboy is offline Offline
Newbie Poster

Floating point in Assembly

 
0
  #1
Nov 23rd, 2008
Can someone suggest me a method to convert a floating point number into binary using assembly?

for example 5.5 would be 000..101.1

but how would you go on about this in assembly?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Floating point in Assembly

 
0
  #2
Nov 24th, 2008
http://babbage.cs.qc.edu/IEEE-754/Decimal.html
Enter 5.5, look at the bit pattern.

Look familiar?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 3
Reputation: ombadboy is an unknown quantity at this point 
Solved Threads: 0
ombadboy ombadboy is offline Offline
Newbie Poster

Re: Floating point in Assembly

 
0
  #3
Nov 24th, 2008
ye ye.. but how would you go on about doing that in assembly?

i mean.. u can convert a floating point to a binary by continuously diving the remainder by 2, and 'saving' the quotient of the division whether its 1 or 0, and form the binary.

The problem that arises with this solution is that only 8 registers are provided, so that would lead to only allowing you to display a binary of 8 bits long (only).
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Floating point in Assembly

 
0
  #4
Nov 25th, 2008
It's already stored in binary, so you just take the mantissa and output a string of 0 and 1. Assuming you've done this exercise for int, then then this step at least is no different.

You then use the exponent to work out where the radix point . goes.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC