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
Fixed-point arithmetic
(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!
===Exact values=== Any binary fraction ''a''/2<sup>''m''</sup>, such as 1/16 or 17/32, can be exactly represented in fixed-point, with a power-of-two scaling factor 1/2<sup>''n''</sup> with any ''n'' β₯ ''m''. However, most decimal fractions like 0.1 or 0.123 are infinite [[repeating fraction]]s in base 2. and hence cannot be represented that way. Similarly, any decimal fraction ''a''/10<sup>''m''</sup>, such as 1/100 or 37/1000, can be exactly represented in fixed point with a power-of-ten scaling factor 1/10<sup>''n''</sup> with any ''n'' β₯ ''m''. This decimal format can also represent any binary fraction ''a''/2<sup>''m''</sup>, such as 1/8 (0.125) or 17/32 (0.53125). More generally, a [[rational number]] ''a''/''b'', with ''a'' and ''b'' [[relatively prime]] and ''b'' positive, can be exactly represented in binary fixed point only if ''b'' is a power of 2; and in decimal fixed point only if ''b'' has no [[prime]] factors other than 2 and/or 5.
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)