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!
==Notations== Various notations have been used to concisely specify the parameters of a fixed-point format. In the following list, ''f'' represents the number of fractional bits, ''m'' the number of magnitude or integer bits, ''s'' the number of sign bits, and ''b'' the total number of bits. * The [[COBOL]] programming language originally supported decimal fixed-precision with arbitrary size and decimal scaling, whose format was specified "graphically" with the {{mono|PIC}} directive. For example, {{code|PIC S9999V99}} specified a sign-magnitude 6-digit decimal integer with two decimal fraction digits.<ref name="cobibm"/> * The construct <code>REAL FIXED BINARY (''p'',''f'')</code> is used in the [[PL/I]] programming language, to specify a fixed-point signed binary data type with ''p'' total bits (not including sign) with ''f'' bits in the fraction part; that is a ''p''+1 bit signed integer with a scaling factor of 1/2<sup>''f''</sup>. The latter could be positive or negative. One could specify {{mono|COMPLEX}} instead of {{mono|REAL}}, and {{mono|DECIMAL}} instead of {{mono|BINARY}} for base 10. * In the [[Ada programming language]], a numeric data type can be specified by, for example,{{code|2=ada|type F is delta 0.01 range -100.0 .. 100.0}}, meaning a fixed-point representation consisting of a signed binary integer in two's complement format with 7 implied fraction bits (providing a scaling factor 1/128) and at least 15 bits total (ensuring an actual range from β128.00 to almost +128.00).<ref name="adafix"/> * The [[Q (number format)|Q notation]] was defined by [[Texas Instruments]].<ref name="TI_2003"/> One writes <code>Q''f''</code> to specify a signed binary fixed-point value with ''f'' fraction bits; for example, {{code|Q15}} specifies a signed integer in two's complement notation with a scaling factor 1/2<sup>15</sup>. The code <code>Q''m''.''f''</code> specifies additionally that the number has ''m'' bits in the integer part of the value, not counting the sign bit. Thus {{code|Q1.30}} would describe a binary fixed-point format with 1 integer bit and 30 fractional bits, which could be stored as a 32-bit 2's complement integer with scaling factor 1/2<sup>30</sup>.<ref name="TI_2003"/><ref name="mwork"/> A similar notation has been used by [[ARM architecture|ARM]], except that they count the sign bit in the value of ''m''; so the same format above would be specified as {{code|Q2.30}}.<ref name="ARM_2001"/><ref name="ARM_2006"/> * The notation <code>B''m''</code> has been used<!--BY WHO?--> to mean a fixed binary format with ''m'' bits in the integer part; the rest of the word being fraction bits. For example, the maximum and minimum values that can be stored in a signed {{code|B16}} number are β32767.9999847 and β32768.0, respectively. * The [[VisSim]] company used <code>fx''m''.''b''</code> to denote a binary fixed-point value with ''b'' total bits and ''m'' bits in the integer part; that is, a ''b''-bit integer with scaling factor 1/2<sup>''b''β''m''</sup>. Thus {{code|fx1.16}} would mean a 16-bit number with 1 bit in the integer part and 15 in the fraction.<ref name="vsi"/> * The [[PS2]] GS ([[PlayStation 2 technical specifications#Graphics processing unit|"Graphics Synthesizer"]]) User's Guide uses the notation <code>''s'':''m'':''f''</code>, where ''s'' specifies the presence (0 or 1) of sign bit.<ref name="PS2"/> For example, {{mono|0:5:3}} represents an unsigned 8-bit integer with a scaling factor of 1/2<sup>3</sup>. * The [[LabVIEW]] programming language uses the notation <code><''s'',''b'',''m''></code> to specify the parameters of an 'FXP' fixed point numbers. The ''s'' component can be either '+' or 'Β±', signifying either an unsigned or 2's complement signed number, respectively. The ''b'' component is the total number of bits, and ''m'' is the number of bits in the integer part.
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)