Bin2F4 - Interpret a binary string value as single precision float

Top  Previous  Next

Syntax

<nFloat> := Bin2F4( <cFloat4> )

Parameters

<cFloat4>

 

Single precision C float value stored in an Xbase++ character string (4 bytes length) to be converted into a numeric value.

Return value

The single precision numeric value contained in <cFloat4>.

Description

Bin2F4 converts the binary representation of a single precision float value (stored as a string) to its numeric meaning. Storing a single precision float value requires 4 bytes.

Classification

Core

Category

Type conversion

Quick Info

Library: cckptcor.lib / cckptcor.dll

See also

F42Bin

Example

 

#INCLUDE "CockpitCoreLibs.ch"

 

FUNCTION Main

 

LOCAL n1,n2,f

 

* This is our test value

n1 := 1.234

 

* Now let's get its binary representation

f := F42Bin(n1)

 

* What does it look like?

? HexString(f)

 

* Convert back to a single precision float

n2 := Bin2F4(f)

 

* Is it identical?

? n2

 

RETURN NIL