Re: The question about the type numeric - Mailing list pgsql-hackers

From David G Johnston
Subject Re: The question about the type numeric
Date
Msg-id 1397615020740-5800174.post@n5.nabble.com
Whole thread Raw
In response to The question about the type numeric  ("sure.postgres" <sure.postgres@gmail.com>)
Responses Re: The question about the type numeric  ("sure.postgres" <sure.postgres@gmail.com>)
List pgsql-hackers
sure.postgres wrote
> Hi hackers,
> 
> I am learning about numeric .
> The comment of NumericShort format is:
>  * In the NumericShort format, the remaining 14 bits of the header word
>  * (n_short.n_header) are allocated as follows: 1 for sign (positive or
>  * negative), 6 for dynamic scale, and 7 for weight.  In practice, most
>  * commonly-encountered values can be represented this way.
> 
> So the Max of the NumericShort format should be up to 508 digits before
> the decimal point.
> So the sign of the number
> 12345678901234567890123456789012345678901234567890
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890
> 12345678901234567890123456789012345678901234567890123456789012345678901234567890
> 12345678901234567890123456789012345678901234567 
> should be 0x807F.
> The number is 257 digits before the decimal point.
> But the sign is 0.
> So is there anything wrong?

[00001000 00000000 00][0][00111 0][0010000]

I appreciate that you got no responses on the original e-mail but if you are
going to re-raise the question at least have the courtesy to respond to your
original thread and not go and start a new one.  And maybe trying rephrasing
the question since most likely your original question was not worded in such
a way to garner a response.

I may have this totally wrong but I don't see why the sign of your number
should be anything but "zero" since that is, I presume, the value of the
specific bit for a positive number - which yours is.

So, in short, nothing seems to "be wrong".  If you think something is wrong
you should probably state what that is explicitly and ask someone to explain
what is happening.

I would have said all this when I saw the first e-mail but I wasn't (and
still am not) totally clear on what you are asking and was hoping someone
more familiar could make better sense of it.

David J.




--
View this message in context:
http://postgresql.1045698.n5.nabble.com/The-question-about-the-type-numeric-tp5800173p5800174.html
Sent from the PostgreSQL - hackers mailing list archive at Nabble.com.



pgsql-hackers by date:

Previous
From: "sure.postgres"
Date:
Subject: The question about the type numeric
Next
From: Amit Kapila
Date:
Subject: Re: Dynamic Shared Memory stuff