Alaska Software Inc. - number to binary float
Username: Password:
AuthorTopic: number to binary float
Raffaele Lafrattanumber to binary float
on Fri, 27 Nov 2020 09:07:30 +0100
Hi all

How can I convert a number to a 32 bit binary float (IEE754 ) ?
F2Bin() converts to a 64 bit double number...

Thanks to all
Raffaele
Frans VermeulenRe: number to binary float
on Mon, 01 Mar 2021 13:16:10 +0100
Hi Raffaele,

Option 1:
In Ot4Xb, there is a function PackFloat32()

Option 2:
Assuming, you need the binary representation like F2Bin():
There is an undocumented function in Xbase++ Float2Bin() 
in XbpRt1.dll in Xbase++ 2.0

Option 3 (also Xbase++ 2.0):
Since you are probable going to use it with a DllCall,
Look in the docs for DLL_TYPE_FLOAT32, use it with DllPrepareCall
then execute with DllExecuteCall.

HTH & regards,
Frans Vermeulen

> Hi all
> 
> How can I convert a number to a 32 bit binary float (IEE754 ) ?
> F2Bin() converts to a 64 bit double number...
> 
> Thanks to all
> Raffaele