Re: [SLUG] Numeric Storage Format

From: Paul M Foster (paulf@quillandmouse.com)
Date: Fri Dec 29 2006 - 16:14:43 EST


Daniel Jarboe wrote:
> > nstr = "57";
> > ch = nstr[0] - '0';
> > number = 10 * ch + nstr[1] - '0';
>
> I think the confusion is he didn't say anything about what "number" is,
> and didn't provide a sufficiently large example.
>
> Paul, so decimal 57 gets encoded in 1 byte: 0x39
>
> Would decimal 1234 be encoded in 2 bytes like like 0x0C 0x22 ?
>

Yes, that's exactly how it would be stored. Since the number is stored
in an array of bytes, it can handle arbitrary precision. Exponent and
sign are stored elsewhere in the structure.

Paul

-- 
Paul M. Foster
-----------------------------------------------------------------------
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:16:35 EDT