Re: [HACKERS] The question about the type numeric

2014-04-17 Thread 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



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.johns...@gmail.com
发送时间:2014-04-16 10:23
主题:Re: [HACKERS] The question about the type numeric
收件人:pgsql-hackerspgsql-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? 

[1000  00][0][00111 0][001] 

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 

Re: [HACKERS] The question about the type numeric

2014-04-16 Thread amulsul
But the sign is 0.
So is there anything wrong?
 
have look in src/backend/utils/adt/numeric.c @ 154  155 for POS  NEG
defination given as
 154 #define NUMERIC_POS 0x
 155 #define NUMERIC_NEG 0x4000

Regards,
Amul Sul



--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/The-question-about-the-type-numeric-tp5800180p5800219.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


Re: [HACKERS] The question about the type numeric

2014-04-16 Thread Robert Haas
On Tue, Apr 15, 2014 at 5:37 AM, sure.postgres sure.postg...@gmail.com 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?

I'm not sure I understand the question, but if it helps, the sign bit
will be set (1) for negative values and clear (0) for positive values.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] The question about the type numeric

2014-04-15 Thread 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?

[1000  00][0][00111 0][001]

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