Обсуждение: The question about the type numeric

Поиск
Список
Период
Сортировка

The question about the type numeric

От
"sure.postgres"
Дата:
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?
 
Thank you!
 
2014-04-15

body { font-size:12.1pt; font-family:simsun,serif; } blockquote { margin-top:0; margin-bottom:0; margin-left:2em; } body { padding:0; margin:0; }
wangshuo
HighGo Software Co.,Ltd.
Address: A203 Block D QILU Soft Park, High-Tech Zone, Lixia district, Jinan Shandong, China(Head Office)
Tel:+86-0531-55701530
Fax:+86-0531-55701544
Website:www.highgo.com
Mobile:18766416137

Re: The question about the type numeric

От
David G Johnston
Дата:
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.



Re: The question about the type numeric

От
"sure.postgres"
Дата:
I am so sorry for that.
This is my fault.
My mail client does not receive any e-mail.
So I tried to re-send the e-mail again.
 
My problem has been resolved.
Thank you for your reply.
 
 
2014-04-16

body { font-size:12.1pt; font-family:simsun,serif; } blockquote { margin-top:0; margin-bottom:0; margin-left:2em; } body { padding:0; margin:0; }
body { font-size:12.1pt; font-family:simsun,serif; } blockquote { margin-top:0; margin-bottom:0; margin-left:2em; } body { padding:0; margin:0; }
wangshuo
HighGo Software Co.,Ltd.
Address: A203 Block D QILU Soft Park, High-Tech Zone, Lixia district, Jinan Shandong, China(Head Office)
Tel:+86-0531-55701530
Fax:+86-0531-55701544
Website:www.highgo.com
Mobile:18766416137

发件人:David G Johnston <david.g.johnston@gmail.com>
发送时间:2014-04-16 10:23
主题:Re: [HACKERS] The question about the type numeric
收件人:"pgsql-hackers"<pgsql-hackers@postgresql.org>
抄送:
 
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. 
 
 
--  
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) 
To make changes to your subscription: 
http://www.postgresql.org/mailpref/pgsql-hackers