Jump to content

Template:Hex

From mediawiki.org
Template documentation

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 Manual:Floating-point errors in expr parser function.

Examples

[edit]
  • {{hex}} β†’
  • {{hex|a}} β†’ a
  • {{hex|0}} β†’ 0
  • {{hex|-0}} β†’ 0
  • {{hex|1/7}} β†’ 1.2492492492492hex*2^-3
  • {{hex|-2/3}} β†’ -1.5555555555555hex*2^-1
  • {{hex|123}} β†’ 1.ec00000000000hex*2^6
  • {{hex|.0123}} β†’ 1.930be0ded288dhex*2^-7
  • {{hex|1+2^-52}} β†’ 1.0000000000001hex*2^0
  • {{hex|1.0000000000000002}} β†’ 1.0000000000001hex*2^0
  • {{hex|1+2e-16}} β†’ 1.0000000000001hex*2^0
  • {{hex|-1e309}} β†’ -INF
  • {{hex|1e309}} β†’ INF
  • {{hex|1e308}} β†’ 1.1ccf385ebc8a0hex*2^1023
  • {{hex|1e307}} β†’ 1.c7b1f3cac7433hex*2^1019
  • {{hex|1e306}} β†’ 1.6c8e5ca239029hex*2^1016
  • {{hex|1e305}} β†’ 1.23a516e82d9bahex*2^1013
  • {{hex|1e304}} β†’ 1.d2a1be4048f90hex*2^1009
  • {{hex|1e303}} β†’ 1.754e31cd072dahex*2^1006
  • {{hex|1e302}} β†’ 1.2aa4f4a405be2hex*2^1003
  • {{hex|1e301}} β†’ 1.ddd4baa009303hex*2^999
  • {{hex|1e300}} β†’ 1.7e43c8800759chex*2^996
  • {{hex|1e299}} β†’ 1.31cfd3999f7b0hex*2^993
  • {{hex|1e298}} β†’ 1.e94c85c298c4chex*2^989
  • {{hex|1e297}} β†’ 1.87706b0213d0ahex*2^986
  • {{hex|1e296}} β†’ 1.3926bc01a973bhex*2^983
  • {{hex|1e295}} β†’ 1.f50ac6690f1f8hex*2^979
  • {{hex|1e294}} β†’ 1.90d56b873f4c7hex*2^976
  • {{hex|1e293}} β†’ 1.40aabc6c32a38hex*2^973
  • {{hex|1e292}} β†’ 1.008896bcf54fahex*2^970
  • {{hex|1e-308}} β†’ 1.cc359e067a348hex*2^-1024
  • {{hex|1e-309}} β†’ 1.702ae4d1fb5ehex*2^-1027
  • {{hex|1e-310}} β†’ 1.2688b70e62bhex*2^-1030
  • {{hex|1e-311}} β†’ 1.d74124e3d1hex*2^-1034
  • {{hex|1e-312}} β†’ 1.7900ea4fd8hex*2^-1037
  • {{hex|1e-313}} β†’ 1.2d9a550cchex*2^-1040
  • {{hex|1e-314}} β†’ 1.e2908814hex*2^-1044
  • {{hex|1e-315}} β†’ 1.820d39ahex*2^-1047
  • {{hex|1e-316}} β†’ 1.34d761hex*2^-1050
  • {{hex|1e-317}} β†’ 1.ee257hex*2^-1054
  • {{hex|1e-318}} β†’ 1.8b510hex*2^-1057
  • {{hex|1e-319}} β†’ 1.3c40hex*2^-1060
  • {{hex|1e-320}} β†’ 1.fa0hex*2^-1064
  • {{hex|1e-321}} β†’ 1.94hex*2^-1067
  • {{hex|1e-322}} β†’ 1.4hex*2^-1070
  • {{hex|1e-323}} β†’ 1.0hex*2^-1073
  • {{hex|1e-323/2}} β†’ 1.hex*2^-1074
  • {{hex|1e-323/3}} β†’ 1.hex*2^-1074
  • {{hex|1e-323/4}} β†’ 0
  • {{hex|.{{loop|323|0}}25}} β†’ 1.hex*2^-1074
  • {{hex|.{{loop|323|0}}24}} β†’ 0
  • {{hex|1000000e-324}} β†’ 0
  • {{hex|1.71*2^-1021}} β†’ 1.b5c28f5c28f5chex*2^-1021
  • {{hex|1.71*2^-1022}} β†’ 1.b5c28f5c28f5chex*2^-1022
  • {{hex|1.71*2^-1023}} β†’ 1.b5c28f5c28f5chex*2^-1023
  • {{hex|1.71*2^-1024}} β†’ 1.b5c28f5c28f5chex*2^-1024
  • {{hex|1.71*2^-1025}} β†’ 1.b5c28f5c28f60hex*2^-1025
  • {{hex|1.71*2^-1064}} β†’ 1.b5chex*2^-1064
  • {{hex|1.71*2^-1065}} β†’ 1.b60hex*2^-1065
  • {{hex|1.71*2^-1066}} β†’ 1.b6hex*2^-1066
  • {{hex|1.71*2^-1067}} β†’ 1.b6hex*2^-1067
  • {{hex|1.71*2^-1068}} β†’ 1.b4hex*2^-1068
  • {{hex|1.71*2^-1069}} β†’ 1.b8hex*2^-1069
  • {{hex|1.71*2^-1070}} β†’ 1.bhex*2^-1070
  • {{hex|1.71*2^-1071}} β†’ 1.chex*2^-1071
  • {{hex|1.71*2^-1072}} β†’ 1.chex*2^-1072
  • {{hex|1.71*2^-1073}} β†’ 1.8hex*2^-1073
  • {{hex|1.71*2^-1074}} β†’ 1.0hex*2^-1073
  • {{hex|3*2^-1074}} β†’ 1.8hex*2^-1073
  • {{hex|2*2^-1074}} β†’ 1.0hex*2^-1073
  • {{hex|1*2^-1074}} β†’ 1.hex*2^-1074

Numbers of type integer which are not exactly representable as float:

  • {{hex|trunc(2^62-512)+trunc511}} β†’ 2hex*2^61