Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Give a string representing the hexadecimal form of a real number
ResourceFunction["RealToHexString"][n,{e,h}] gives the hexadecimal string corresponding to n, with an exponent field of e bits and a total length of h hex digits. | |
ResourceFunction["RealToHexString"][n] gives the hexadecimal string for n, using the common IEEE double-precision values of 11 exponent bits and 64 bits total. |
Find the hexadecimal string for the decimal 1.1:
In[1]:= | ![]() |
Out[1]= | ![]() |
RealToHexString will handle arbitrary-precision reals:
In[2]:= | ![]() |
Out[2]= | ![]() |
RealToHexString can return a string with length exceeding the capacity of a machine double-precision value:
In[3]:= | ![]() |
Out[3]= | ![]() |
RealToHexString will pad with zeros if the number of hex digits to return makes it exceed the internal precision of the input:
In[4]:= | ![]() |
Out[4]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License