Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Hex to Float conversion

myousuff81
7 - Meteor

Can you please help me with the following,

 

I am trying to convert a hexadecimal value to a floating number for example 3fa0000000000000 is the hex and its corresponding floating value should be 0.03125. Another example3f847ae147ae147b and the corresponding floating point number is 0.01

 

 

Is there any inbuilt formula to achieve the desired result? Any samples?

8 REPLIES 8
mattreynolds
9 - Comet

Couldn't find an inbuilt function off the bat and HexToNumber() only seems to work for integers. Was able to set up a Formula Tool to do the calculation (see attached - needs testing). Also added a Python example to do the same. 

 

Found this along the way: https://babbage.cs.qc.cuny.edu/IEEE-754.old/64bit.html

 

Hope this helps!

 

myousuff81
7 - Meteor

Thanks it works. Appreciate your help.

mattreynolds
9 - Comet

Thats great!

 

If you don’t mind marking as the solution, that would be a big help!

 

Thanks!

Maty

myousuff81
7 - Meteor

Done.

myousuff81
7 - Meteor

Hi,

 

Need your help again,

 

Could you please help me to convert the 8 Byte Hex to 32 bit signed integer.

 

For example

HEX: c0030000 and its corresponding   32 bit signed integer should be -1073545216

mattreynolds
9 - Comet

Using two's complement. 

 

https://en.wikipedia.org/wiki/Two%27s_complement 

 

Example workflow is attached. Like the case for doubles, will want to test further. 

 

Thanks!

Matt

myousuff81
7 - Meteor

Thanks Matt. Appreciate all your help.

myousuff81
7 - Meteor

Hi Matt,

 

How do I convert a Hex to 16 Bit signed integer for example

 

c0030000 the corresponding value should be 30

 

 

Labels
Top Solution Authors