pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feedThe question about the type numeric
7+ messages / 4 participants
[nested] [flat]
* The question about the type numeric
@ 2014-04-15 09:37 sure.postgres <sure.postgres@gmail.com>
2014-04-16 15:08 ` Re: The question about the type numeric Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: sure.postgres @ 2014-04-15 09:37 UTC (permalink / raw)
To: pgsql-hackers
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?
2014-04-15
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: The question about the type numeric
2014-04-15 09:37 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
@ 2014-04-16 15:08 ` Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Robert Haas @ 2014-04-16 15:08 UTC (permalink / raw)
To: sure.postgres <sure.postgres@gmail.com>; +Cc: pgsql-hackers
On Tue, Apr 15, 2014 at 5:37 AM, sure.postgres <sure.postgres@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
^ permalink raw reply [nested|flat] 7+ messages in thread
* The question about the type numeric
@ 2014-04-16 02:04 sure.postgres <sure.postgres@gmail.com>
2014-04-16 02:23 ` Re: The question about the type numeric David G Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: sure.postgres @ 2014-04-16 02:04 UTC (permalink / raw)
To: pgsql-hackers
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
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: The question about the type numeric
2014-04-16 02:04 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
@ 2014-04-16 02:23 ` David G Johnston <david.g.johnston@gmail.com>
2014-04-17 06:39 ` Re: The question about the type numeric sure.postgres <sure.postgres@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: David G Johnston @ 2014-04-16 02:23 UTC (permalink / raw)
To: 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.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: The question about the type numeric
2014-04-16 02:04 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
2014-04-16 02:23 ` Re: The question about the type numeric David G Johnston <david.g.johnston@gmail.com>
@ 2014-04-17 06:39 ` sure.postgres <sure.postgres@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: sure.postgres @ 2014-04-17 06:39 UTC (permalink / raw)
To: David G Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-hackers
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.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
^ permalink raw reply [nested|flat] 7+ messages in thread
* The question about the type numeric
@ 2014-04-16 03:17 sure.postgres <sure.postgres@gmail.com>
2014-04-16 08:56 ` Re: The question about the type numeric amulsul <sul_amul@yahoo.co.in>
0 siblings, 1 reply; 7+ messages in thread
From: sure.postgres @ 2014-04-16 03:17 UTC (permalink / raw)
To: pgsql-hackers; +Cc: pgsql-hackers
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?
2014-04-15
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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: The question about the type numeric
2014-04-16 03:17 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
@ 2014-04-16 08:56 ` amulsul <sul_amul@yahoo.co.in>
0 siblings, 0 replies; 7+ messages in thread
From: amulsul @ 2014-04-16 08:56 UTC (permalink / raw)
To: pgsql-hackers
>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 0x0000
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
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2014-04-17 06:39 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 09:37 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
2014-04-16 15:08 ` Robert Haas <robertmhaas@gmail.com>
2014-04-16 02:04 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
2014-04-16 02:23 ` David G Johnston <david.g.johnston@gmail.com>
2014-04-17 06:39 ` sure.postgres <sure.postgres@gmail.com>
2014-04-16 03:17 The question about the type numeric sure.postgres <sure.postgres@gmail.com>
2014-04-16 08:56 ` amulsul <sul_amul@yahoo.co.in>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox