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!
==Computer language support== Explicit support for fixed-point numbers is provided by a few programming languages, notably [[PL/I]], [[COBOL]], [[Ada programming language|Ada]], [[JOVIAL]], and [[Coral 66]]. They provide fixed-point [[data type]]s, with a binary or decimal scaling factor. The compiler automatically generates code to do the appropriate scaling conversions when doing operations on these data types, when reading or writing variables, or when converting the values to other data types such as floating-point. Most of those languages were designed between 1955 and 1990. More modern languages usually do not offer any fixed-point data types or support for scaling factor conversion. That is also the case for several older languages that are still very popular, like [[FORTRAN]], [[C (programming language)|C]] and [[C++]]. The wide availability of fast floating-point processors, with strictly standardized behavior, has greatly reduced the demand for binary fixed-point support.{{cn|date=October 2021}} Similarly, the support for [[decimal floating point]] in some programming languages, like [[C Sharp language|C#]] and [[Python (programming language)|Python]], has removed most of the need for decimal fixed-point support. In the few situations that call for fixed-point operations, they can be implemented by the programmer, with explicit scaling conversion, in any programming language. On the other hand, all relational [[database]]s and the [[SQL]] notation support fixed-point decimal arithmetic and storage of numbers. [[PostgreSQL]] has a special <samp>numeric</samp> type for exact storage of numbers with up to 1000 digits.<ref name="PostgreSQL"/> Moreover, in 2008 the [[International Organization for Standardization]] (ISO) issued a proposal to extend the C programming language with fixed-point data types, for the benefit of programs running on embedded processors.<ref name="JTC1_2008"/> Also, the [[GNU Compiler Collection]] (GCC) has [[compiler#Back end|back-end]] support for fixed-point.<ref name="gccback"/><ref name="gccuse"/>
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)