Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to read the binary value of a floating point ?

Status
Not open for further replies.

mdamdam

Member level 3
Member level 3
Joined
Apr 12, 2002
Messages
55
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
the old Europa
Activity points
464
I am working in Delphi,
I need to convert a 4 byte floating point number ( single ) into the 4 variable of one byte.
example:

var
i : single;
i1,i2,i3,i4 : byte;

begin
i:=15;
...
// in memory i= $41 70 00 00 in IEEE 4 byte format

how can I convert i to i1=$41 , i2 = $70, i3=$00, i4=$00 ????

Many thanks
DamDam
 

In C language :

char i1,i2,i3,i4,*ptr;
float i; // i:single in pascal

ptr=(char * ) &i;
i1=*ptr;
i2=*(ptr+1)
i3=*(ptr+2)
i4=*(ptr+3)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top