Template:Hex/doc
It contains usage information, categories, and other content that is not part of the original template page.
This template shows the exact value of a number of type float.
The significand is given in hexadecimal format, which, apart from the sign, consists of a fixed "1.
", followed by 13 hexadecimal characters.
Denormal numbers are shown in normalized format, not in internal format, but without inherently zero digits.
No distinction is made between 0 and -0.
For numbers of type integer which are not exactly representable as float the integer is rounded to float. If an integer just below 2^n is rounded to 2^n the result is shown in the form 2*2^(n-1), thus giving the exponent the value it would have in an exact floating-point representation (which would require up to 10 bits more, hence up to three hexadecimal digits more).
See also Help:Calculation accuracy.
Examples
[edit ]{{hex}}
→{{hex|a}}
→a
{{hex|0}}
→0
{{hex|-0}}
→0
{{hex|1/7}}
→Template:Significand2 hex *2^-3
{{hex|-2/3}}
→-Template:Significand2 hex *2^-1
{{hex|123}}
→Template:Significand2 hex *2^6
{{hex|.0123}}
→Template:Significand2 hex *2^-7
{{hex|1+2^-52}}
→Template:Significand2 hex *2^0
{{hex|1.0000000000000002}}
→Template:Significand2 hex *2^0
{{hex|1+2e-16}}
→Template:Significand2 hex *2^0
{{hex|-1e309}}
→-INF
{{hex|1e309}}
→INF
{{hex|1e308}}
→Template:Significand2 hex *2^1023
{{hex|1e307}}
→Template:Significand2 hex *2^1019
{{hex|1e306}}
→Template:Significand2 hex *2^1016
{{hex|1e305}}
→Template:Significand2 hex *2^1013
{{hex|1e304}}
→Template:Significand2 hex *2^1009
{{hex|1e303}}
→Template:Significand2 hex *2^1006
{{hex|1e302}}
→Template:Significand2 hex *2^1003
{{hex|1e301}}
→Template:Significand2 hex *2^999
{{hex|1e300}}
→Template:Significand2 hex *2^996
{{hex|1e299}}
→Template:Significand2 hex *2^993
{{hex|1e298}}
→Template:Significand2 hex *2^989
{{hex|1e297}}
→Template:Significand2 hex *2^986
{{hex|1e296}}
→Template:Significand2 hex *2^983
{{hex|1e295}}
→Template:Significand2 hex *2^979
{{hex|1e294}}
→Template:Significand2 hex *2^976
{{hex|1e293}}
→Template:Significand2 hex *2^973
{{hex|1e292}}
→Template:Significand2 hex *2^970
{{hex|1e-308}}
→Template:Significand2 hex *2^-1024
{{hex|1e-309}}
→Template:Significand2 hex *2^-1027
{{hex|1e-310}}
→Template:Significand2 hex *2^-1030
{{hex|1e-311}}
→Template:Significand2 hex *2^-1034
{{hex|1e-312}}
→Template:Significand2 hex *2^-1037
{{hex|1e-313}}
→Template:Significand2 hex *2^-1040
{{hex|1e-314}}
→Template:Significand2 hex *2^-1044
{{hex|1e-315}}
→Template:Significand2 hex *2^-1047
{{hex|1e-316}}
→Template:Significand2 hex *2^-1050
{{hex|1e-317}}
→Template:Significand2 hex *2^-1054
{{hex|1e-318}}
→Template:Significand2 hex *2^-1057
{{hex|1e-319}}
→Template:Significand2 hex *2^-1060
{{hex|1e-320}}
→Template:Significand2 hex *2^-1064
{{hex|1e-321}}
→Template:Significand2 hex *2^-1067
{{hex|1e-322}}
→Template:Significand2 hex *2^-1070
{{hex|1e-323}}
→Template:Significand2 hex *2^-1073
{{hex|1e-323/2}}
→Template:Significand2 hex *2^-1074
{{hex|1e-323/3}}
→Template:Significand2 hex *2^-1074
{{hex|1e-323/4}}
→0
{{hex|.{{loop|323|0}}25}}
→Template:Significand2 hex *2^-1074
{{hex|.{{loop|323|0}}24}}
→0
{{hex|1000000e-324}}
→0
{{hex|1.71*2^-1021}}
→Template:Significand2 hex *2^-1021
{{hex|1.71*2^-1022}}
→Template:Significand2 hex *2^-1022
{{hex|1.71*2^-1023}}
→Template:Significand2 hex *2^-1023
{{hex|1.71*2^-1024}}
→Template:Significand2 hex *2^-1024
{{hex|1.71*2^-1025}}
→Template:Significand2 hex *2^-1025
{{hex|1.71*2^-1064}}
→Template:Significand2 hex *2^-1064
{{hex|1.71*2^-1065}}
→Template:Significand2 hex *2^-1065
{{hex|1.71*2^-1066}}
→Template:Significand2 hex *2^-1066
{{hex|1.71*2^-1067}}
→Template:Significand2 hex *2^-1067
{{hex|1.71*2^-1068}}
→Template:Significand2 hex *2^-1068
{{hex|1.71*2^-1069}}
→Template:Significand2 hex *2^-1069
{{hex|1.71*2^-1070}}
→Template:Significand2 hex *2^-1070
{{hex|1.71*2^-1071}}
→Template:Significand2 hex *2^-1071
{{hex|1.71*2^-1072}}
→Template:Significand2 hex *2^-1072
{{hex|1.71*2^-1073}}
→Template:Significand2 hex *2^-1073
{{hex|1.71*2^-1074}}
→Template:Significand2 hex *2^-1073
{{hex|3*2^-1074}}
→Template:Significand2 hex *2^-1073
{{hex|2*2^-1074}}
→Template:Significand2 hex *2^-1073
{{hex|1*2^-1074}}
→Template:Significand2 hex *2^-1074
Numbers of type integer which are not exactly representable as float:
{{hex|trunc(2^62-512)+trunc511}}
→Template:Significand2 hex *2^61