lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


The kind of BCD I was thinking of is not the kind with an implied decimal
point or a special decimal point symbol. You can do floating point decimal
arithmetic - you have a mantissa and exponent just like binary FP but the
digits are all stored as BCD (you can store the exponent as a simple
binary byte if you can live with a range of 10^-128..10^+127). According
to this page:-

	http://www2.hursley.ibm.com/decimal/decimal.html

...the IEEE 854 standards actually allow for decimal as well as binary
floating point, it's just that decimal is used much less often. Since the
mantissa is an array of bytes, you can let the user choose and even change
the number of significant digits at runtime and it can be anything that
will fit in memory.

I don't think decimal should be seen as a relic of the IBM mainframe age.
It has desirable properties but is inefficient. We used to think of
interpreted languages as desirable/inefficient but in the age of faster
processors, we have Lua and we are all the better off for it.

&.

Lua list <lua@bazar2.conectiva.com.br> on Friday, August 25, 2006 at 00:45
+0000 wrote:
>The decimal point is handled by implication. Consider all things
>to be integer. So
>
>1.23 + 1.23 = 2.46 --we have an implied 2 decimal places
>
>1/2 = 1 or 1.5  --depends on the size of the result field
>
>BCD and COBOL hence go well together with declarations
>like "####.##"
>
>>From distant memory the IBM size of these declarations is
>limited to about 18 digits (which covers most financial
>apps).
>
>DB
>
>On 8/25/06, Sam Roberts <sroberts@bycast.com> wrote:
>>
>> I couldn't find on wikipedia mention of how the decimal point is
>> handled, just the sign. Anybody know?
>
>#####################################################################################
>This e-mail message has been scanned for Viruses and Content and cleared 
>by MailMarshal.
>The Blackpool Sixth Form College.
>#####################################################################################



#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared 
by MailMarshal.
The Blackpool Sixth Form College.
#####################################################################################