Re: [SLUG] Numeric Storage Format

From: Ian C. Blenke (icblenke@nks.net)
Date: Fri Dec 29 2006 - 12:33:21 EST


Paul M Foster wrote:

> No no no. BCD stores one digit per nibble. The "digits" here aren't
> stored as digits. Each byte contains a binary number from 0-99. The
> example above, expressed as hexadecimal, would be stored as 0x39.

Right. Like I said, you already understand BCD isn't what we're talking
about here.

You realize that 0x39 (hex) is 57 (decimal), right? or 00111001 binary.
It's a binary integer. Pure and simple.

> FWIW, the link to the library in question is:
>
> http://www.tc.umn.edu/~ringx004/mapm-main.html
>
> I'm having to do price lists and payroll in PHP, and the math
> inaccuracies are killing me. I haven't been able to find any *good*
> arbitrary precision library for PHP, so I'm working or porting or
> adapting this C library to PHP.
>
> So anyway, what do you call this storage format?

I call it an integer. Just a plain, raw binary integer. 8 bits contain
an integer value between 0 and 99. The high-bit remains unused (as 128
is never reached). Don't know how else to explain this to you.

    unsigned short int number;
    number=57;

Assuming that a "short int" is an 8 bit value for your
architecture/platform/compiler.

If integer isn't adequate to explain a storage format to you, what do
you want to see?

    |Byte|
    |8 Bits/Byte: 8 Significant Binary Digits: 76543210|
    |%00111001|
    |0x39|
    |57|

Just trying to understand what you're trying to tell me here.

- Ian

-----------------------------------------------------------------------
This list is provided as an unmoderated internet service by Networked
Knowledge Systems (NKS). Views and opinions expressed in messages
posted are those of the author and do not necessarily reflect the
official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:15:43 EDT