Page 2 of 2

Posted: Mon Apr 06, 2009 4:52 pm
by pdwyer
@Kaeru, Maybe you just want the hex representation of the float data for something...

Code: Select all

Fl.f = 1.23456
Lng.l = 0
PokeL(@Lng,PeekL(@Fl))
Debug Hex(Lng)

Posted: Mon Apr 06, 2009 5:59 pm
by Kaeru Gaman
well sure, but this is not the functionality of a HEX() function.

a HEX() function returns the hexadecimal notation of a given decimal number. period.

any showing the bitmask of a floating-point storage has N.O.T.H.I.N.G. to do with this functionallity,
and thus SHOULD NOT be implemented into this function call.


b.t.w. this is also a problem that could be solved with a container:

Code: Select all

Structure FloLo
  StructureUnion
    L.l
    F.f
  EndStructureUnion
EndStructure

Define container.FloLo

container\F = 1.23456 

Debug container\L
Debug Hex( container\L )

Debug  Bin( container\L )
plain to see here:
the container holds the bit represents of the number put in, in this case a float.
debug it as long to get the decimal integer represent, use HEX() on it to display the Hexadecimal integer represent.

only the binary display shows anything of use, beause you can (potentially) identify mantissa and exponent.
in both other notations the border of them falls into a single digit, so you cant devide them by looking at the number.