Binary coded decimal: Difference between revisions

m
(added Free Pascal)
m (→‎{{header|J}}: grammar)
Line 96:
16b99</lang>
 
Note that we're actually using a hex representation as an intermediate result here. Technically, though, sticking with built in arithmetic and formatting as decimal, but gluing the '16b' prefix onto the formatted result would have been more efficient. And that says a lot about bcd representation. (The value of bcd is not efficiency, but how it handles edge cases. Consider the [https://en.wikipedia.org/wiki/IEEE_754#Decimal decimal IEEE 754] format as an example where this might be considered significant. There are other ways to achieve those edge cases -- bcd happens to be relevant, when building the mechanisms into hardware.)
 
For reference, here are decimal and binary representations of the above numbers:
Line 115:
25
NB. ...</lang>
 
=={{header|Pascal}}==
==={{header|Free Pascal}}===
6,951

edits