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!
===Scaling and renormalization=== Typical processors do not have specific support for fixed-point arithmetic. However, most computers with binary arithmetic have fast [[bit shift]] instructions that can multiply or divide an integer by any power of 2; in particular, an [[arithmetic shift]] instruction. These instructions can be used to quickly change scaling factors that are powers of 2, while preserving the sign of the number. Early computers like the [[IBM 1620]] and the [[Burroughs Medium Systems|Burroughs B3500]] used a [[binary-coded decimal]] (BCD) representation for integers, namely base 10 where each decimal digit was independently encoded with 4 bits. Some processors, such as microcontrollers, may still use it. In such machines, conversion of decimal scaling factors can be performed by bit shifts and/or by memory address manipulation. Some DSP architectures offer native support for specific fixed-point formats, for example, signed ''n''-bit numbers with ''n''−1 fraction bits (whose values may range between −1 and almost +1). The support may include a multiply instruction that includes renormalization—the scaling conversion of the product from 2''n''−2 to ''n''−1 fraction bits.{{cn|date=July 2021}} If the CPU does not provide that feature, the programmer must save the product in a large enough register or temporary variable, and code the renormalization explicitly.
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)