Re: [SLUG] Numeric Storage Format

From: Eben King (eben01@verizon.net)
Date: Fri Dec 29 2006 - 02:05:18 EST


On Fri, 29 Dec 2006, Paul M Foster wrote:

> Folks:
>
> Some of you must know the answer to this. I'm working with an arbitrary
> precision library, and the fellow who wrote it is storing values in an array
> of characters. Within each "character" is essentially a binary number from 0
> - 99. This is a C library, so if you had a number like 57 and you wanted to
> store it (and assuming you had the number as a string) you'd store it like:
>
> nstr = "57";
> ch = nstr[0] - '0';
> number = 10 * ch + nstr[1] - '0';

So in memory it'd be '5' '7' NUL = 0x35 0x37 0x00, right?

I did that, in an arbitrary-precision library I wrote. BCD would have been
half the size, but slower to extract and store. More complicated too, which
was of greater concern, given my coding skills.

> Okay, now after all the explanation, what is this storage format *called*?
> It's not BCD, and it's not packed decimal. I'd like to know what it's called,
> so I can look up references on it.

I'd call it "stored as an ASCII string" m'self, but ICBW.

-- 
-eben     QebWenE01R@vTerYizUonI.nOetP     royalty.no-ip.org:81

Only two things are infinite, the universe and human stupidity, and I'm not sure about the former." -- Albert Einstein ----------------------------------------------------------------------- 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:22 EDT