Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
IBM hexadecimal floating-point
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Precision issues == Since the base is 16, there can be up to three leading zero bits in the binary significand. That means when the number is converted into binary, there can be as few as 21 bits of precision. Because of the "wobbling precision" effect, this can cause some calculations to be very inaccurate. This has caused considerable criticism.<ref name="Warren_2013">{{cite book |title=Hacker's Delight |title-link=Hacker's Delight |author-first=Henry S. |author-last=Warren Jr. |date=2013 |orig-year=2002 |edition=2 |chapter=The Distribution of Leading Digits|publisher=[[Addison Wesley]] - [[Pearson Education, Inc.]] |isbn=978-0-321-84268-8 |id=0-321-84268-5 |pages=385β387}}</ref> A good example of the inaccuracy is representation of decimal value 0.1. It has no exact binary or hexadecimal representation. In hexadecimal format, it is represented as 0.19999999...<sub>16</sub> or 0.0001 1001 1001 1001 1001 1001 1001...<sub>2</sub>, that is: :{| |- style="text-align:center" |style="width:20px;text-align:center;background-color:#FC9"|S |style="width:90px;text-align:center;background-color:#99F"|Exp |style="width:250px;text-align:center;background-color:#9F9"|Fraction |style="text-align:center;background-color:#FFF"| |- style="text-align:center" |style="text-align:center;background-color:#FEC"|{{mono|0}} |style="text-align:center;background-color:#CCF"|{{mono|100 0000}} |style="text-align:center;background-color:#CFC"|{{mono|0001 1001 1001 1001 1001 1010}} |style="text-align:center;background-color:#FFF"| |} This has only 21 bits, whereas the binary version has 24 bits of precision. Six hexadecimal digits of precision is roughly equivalent to six decimal digits (i.e. (6 β 1) log<sub>10</sub>(16) β 6.02). A conversion of single precision hexadecimal float to decimal string would require at least 9 significant digits (i.e. 6 log<sub>10</sub>(16) + 1 β 8.22) in order to convert back to the same hexadecimal float value.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)