Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Binary-coded decimal
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
=={{anchor|Zoned BCD}}Zoned decimal== Some implementations, for example [[IBM]] mainframe systems, support '''zoned decimal''' numeric representations. Each decimal digit is stored in one 8-bit<ref group=nb>6-bit for older machines.</ref> byte, with the lower four bits encoding the digit in BCD form. The upper four<ref group=nb>Two for older machines.</ref> bits, called the "zone" bits, are usually set to a fixed value so that the byte holds a character value corresponding to the digit, or to values representing plus or minus. EBCDIC<ref group=nb>The values shown for {{base|C0|16}} and {{base|D0|16}} are for code page 037.</ref> systems use a zone value of {{base|1111|2}} ({{base|F|16}}), yielding {{base|F0|16}}-{{base|F9|16}}, the codes for "0" through "9", a zone value of {{base|1100|2}} ({{base|C|16}}) for positive, yielding {{base|C0|16}}-{{base|C9|16}}, the codes for "{" through "I" and a zone value of {{base|1110|2}} ({{base|D|16}}) for negative, yielding {{base|D0|16}}-{{base|D9|16}}, the codes for the characters "}" through "R". Similarly, ASCII systems use a zone value of 0011 (hex 3), giving character codes 30 to 39 (hex). For signed zoned decimal values, the rightmost (least significant) zone nibble holds the sign digit, which is the same set of values that are used for signed packed decimal numbers (see above). Thus a zoned decimal value encoded as the hex bytes F1 F2 D3 represents the signed decimal value β123: F1 F2 D3 1 2 β3 ===EBCDIC zoned decimal conversion table=== <!-- Note that this table should also include codes A0-A9, B0-B9, and E0-E9 for completeness. --> {| style="margin:auto; width:70%;" class="wikitable" |- ! style="background:#e0e0e0;"|BCD digit ! style="background:#e0e0e0;" colspan="4"|Hexadecimal ! style="background:#e0e0e0;" colspan="4"|EBCDIC character |- style="text-align:center; font-family: monospace; font-size: larger" | style="width:20%; width:12%;"|0+ | style="width:10%; width:11%;"|C0 | style="width:10%; width:11%;"|A0 | style="width:10%; width:11%;"|E0 | style="width:10%; width:11%;"|F0 | style="width:10%; width:11%;"|{ (*) | style="width:10%; width:11%; background:#f0f0f0;"| | style="width:10%; width:11%;"|\ (*) | style="width:10%; width:11%;"|0 |- style="text-align:center; font-family: monospace; font-size: larger" ||1+ ||C1 ||A1 ||E1 ||F1 ||A ||~ (*) | style="background:#f0f0f0;"| ||1 |- style="text-align:center; font-family: monospace; font-size: larger" ||2+ ||C2 ||A2 ||E2 ||F2 ||B ||s ||S ||2 |- style="text-align:center; font-family: monospace; font-size: larger" ||3+ ||C3 ||A3 ||E3 ||F3 ||C ||t ||T ||3 |- style="text-align:center; font-family: monospace; font-size: larger" ||4+ ||C4 ||A4 ||E4 ||F4 ||D ||u ||U ||4 |- style="text-align:center; font-family: monospace; font-size: larger" ||5+ ||C5 ||A5 ||E5 ||F5 ||E ||v ||V ||5 |- style="text-align:center; font-family: monospace; font-size: larger" ||6+ ||C6 ||A6 ||E6 ||F6 ||F ||w ||W ||6 |- style="text-align:center; font-family: monospace; font-size: larger" ||7+ ||C7 ||A7 ||E7 ||F7 ||G ||x ||X ||7 |- style="text-align:center; font-family: monospace; font-size: larger" ||8+ ||C8 ||A8 ||E8 ||F8 ||H ||y ||Y ||8 |- style="text-align:center; font-family: monospace; font-size: larger" ||9+ ||C9 ||A9 ||E9 ||F9 ||I ||z ||Z ||9 |- style="text-align:center; font-family: monospace; font-size: larger" ||0β ||D0 ||B0 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||} (*) ||^ (*) | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||1β ||D1 ||B1 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||J | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||2β ||D2 ||B2 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||K | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||3β ||D3 ||B3 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||L | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||4β ||D4 ||B4 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||M | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||5β ||D5 ||B5 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||N | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||6β ||D6 ||B6 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||O | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||7β ||D7 ||B7 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||P | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||8β ||D8 ||B8 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||Q | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |- style="text-align:center; font-family: monospace; font-size: larger" ||9β ||D9 ||B9 | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| ||R | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| | style="background:#f0f0f0;"| |} (*) ''Note: These characters vary depending on the local character [[code page]] setting.'' ===Fixed-point zoned decimal=== Some languages (such as COBOL and PL/I) directly support fixed-point zoned decimal values, assigning an implicit decimal point at some location between the decimal digits of a number. For example, given a six-byte signed zoned decimal value with an implied decimal point to the right of the fourth digit, the hex bytes F1 F2 F7 F9 F5 C0 represent the value +1,279.50: F1 F2 F7 F9 F5 C0 1 2 7 9. 5 +0
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Binary-coded decimal
(section)
Add topic