Skip Menu |
 

This queue is for tickets about the Bit-Vector CPAN distribution.

Report information
The Basics
Id: 39714
Status: rejected
Worked: 15 min
Priority: 0/
Queue: Bit-Vector

People
Owner: Nobody in particular
Requestors: Stephen.Gray [...] maxim-ic.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



X-Originalarrivaltime: 30 Sep 2008 17:58:45.0673 (UTC) FILETIME=[2EBE6990:01C92326]
X-Dalsemi-Mailscanner-From: stephen.gray [...] maxim-ic.com
MIME-Version: 1.0
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,SPF_PASS
Acceptlanguage: en-US
Content-Language: en-US
content-type: text/plain; charset="utf-8"
X-MS-Tnef-Correlator:
Received: from x1.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 129F74D80C8 for <bug-Bit-Vector [...] rt.cpan.org>; Tue, 30 Sep 2008 14:00:27 -0400 (EDT)
Received: (qmail 10495 invoked from network); 30 Sep 2008 18:00:27 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 30 Sep 2008 18:00:27 -0000
Received: from chewy2.dalsemi.com (HELO hawaii.dalsemi.com) (205.153.101.8) by 16.mx.develooper.com (qpsmtpd/0.43rc1) with ESMTP; Tue, 30 Sep 2008 11:00:24 -0700
Received: from terlingua.dalsemi.com (terlingua [180.0.34.46]) by hawaii.dalsemi.com (8.13.6/8.13.6) with ESMTP id m8UHwkXm018761 for <bug-Bit-Vector [...] rt.cpan.org>; Tue, 30 Sep 2008 12:58:46 -0500 (CDT)
Received: from itdalex02.it.maxim-ic.internal (itdalex02.it.maxim-ic.internal [10.16.15.7]) by terlingua.dalsemi.com (8.10.2/8.10.2) with ESMTP id m8UHwkL28220 for <bug-Bit-Vector [...] rt.cpan.org>; Tue, 30 Sep 2008 12:58:46 -0500 (CDT)
Received: from itdalias01.it.maxim-ic.internal ([10.16.15.60]) by itdalex02.it.maxim-ic.internal with Microsoft SMTPSVC(6.0.3790.1830); Tue, 30 Sep 2008 12:58:45 -0500
Received: from maxdalex02.maxim-ic.internal (10.16.15.106) by itdalias01.it.maxim-ic.internal (10.16.15.60) with Microsoft SMTP Server (TLS) id 8.1.240.5; Tue, 30 Sep 2008 12:58:45 -0500
Received: from ITDALEX06.it.maxim-ic.internal ([10.16.15.67]) by maxdalex02.maxim-ic.internal ([fe80::a9b9:ae01:e419:93af%10]) with mapi; Tue, 30 Sep 2008 12:58:44 -0500
Delivered-To: cpan-bug+Bit-Vector [...] diesel.bestpractical.com
Subject: Bug - Must allocate extra space to receive valid data in conversion from hex to decimal
Return-Path: <Stephen.Gray [...] maxim-ic.com>
X-Original-To: bug-Bit-Vector [...] rt.cpan.org
X-Spam-Check-BY: 16.mx.develooper.com
Thread-Index: AQHJIyYQWCAOilWYmEyT9j4eUb8apQ==
X-Old-Spam-Status: No
Date: Tue, 30 Sep 2008 12:57:54 -0500
X-Spam-Level: *
X-MS-Has-Attach:
Thread-Topic: Bug - Must allocate extra space to receive valid data in conversion from hex to decimal
X-Dalsemi-Mailscanner: Found to be clean
Message-Id: <7BB8BF95A41BB042B5FFB96522BF4CFF2A4E5757F7 [...] ITDALEX06.it.maxim-ic.internal>
To: "bug-Bit-Vector [...] rt.cpan.org" <bug-Bit-Vector [...] rt.cpan.org>
Accept-Language: en-US
X-Dalsemi-Mailscanner-Information: Please contact the ISP for more information
Content-Transfer-Encoding: quoted-printable
From: Stephen P Gray <Stephen.Gray [...] maxim-ic.com>
X-RT-Original-Encoding: us-ascii
Content-Length: 826
Download (untitled) / with headers
text/plain 826b
When declaring a new_Hex item one must pad at least one extra bit in the size field or when converting to decimal the value returned is invalid. Show quoted text
>>> Code >>>
my $hex = '966104526fe7d8baac32d27124a467b8'; my $vec = Bit::Vector->new_Hex(128, $hex); print "128 bits - $hex => " . $vec->to_Dec() . "\n"; my $vec2 = Bit::Vector->new_Hex(129, $hex); print "129 bits - $hex => " . $vec2->to_Dec() . "\n"; <<< End Code <<< Show quoted text
>>> Output >>>
128 bits - 966104526fe7d8baac32d27124a467b8 => -140394427096942342042315520958275491912 129 bits - 966104526fe7d8baac32d27124a467b8 => 199887939823996121421059086473492719544 <<< End Output <<< OS: SunOS caddo 5.8 Generic_117350-36 sun4u sparc Perl::Version: 5.8.1 Bit::Vector::Version: 6.4 Stephen P. Gray Maxim Integrated Products Test Engineer I (972) 371-4631 Stephen.Gray@maxim-ic.com
MIME-Version: 1.0
In-Reply-To: <7BB8BF95A41BB042B5FFB96522BF4CFF2A4E5757F7 [...] ITDALEX06.it.maxim-ic.internal>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <7BB8BF95A41BB042B5FFB96522BF4CFF2A4E5757F7 [...] ITDALEX06.it.maxim-ic.internal>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-14916-1248695195-750.39714-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 2023
Download (untitled) / with headers
text/plain 1.9k
On Tue Sep 30 14:00:46 2008, Stephen.Gray@maxim-ic.com wrote: Show quoted text
> When declaring a new_Hex item one must pad at least one extra bit in > the size field or when converting to decimal the value returned is > invalid. >
> >>> Code >>>
> my $hex = '966104526fe7d8baac32d27124a467b8'; > my $vec = Bit::Vector->new_Hex(128, $hex); > print "128 bits - $hex => " . $vec->to_Dec() . "\n"; > > my $vec2 = Bit::Vector->new_Hex(129, $hex); > print "129 bits - $hex => " . $vec2->to_Dec() . "\n"; > > <<< End Code <<< >
> >>> Output >>>
> 128 bits - 966104526fe7d8baac32d27124a467b8 => > -140394427096942342042315520958275491912 > 129 bits - 966104526fe7d8baac32d27124a467b8 => > 199887939823996121421059086473492719544 > <<< End Output <<< > > OS: SunOS caddo 5.8 Generic_117350-36 sun4u sparc > Perl::Version: 5.8.1 > Bit::Vector::Version: 6.4 > > Stephen P. Gray > Maxim Integrated Products > Test Engineer I > (972) 371-4631 > Stephen.Gray@maxim-ic.com
This is the intended and documented behaviour, due to the internal two's complement representation of numbers, the switching between unsigned and signed semantics and the lack of "sign extension" in the from/to_Hex methods (the "Copy" method does that, however - see the manual!). CODE: #!perl -w use Bit::Vector; my $hex = '966104526fe7d8baac32d27124a467b8'; my $vec = Bit::Vector->new_Hex(128, $hex); print "128 bits - $hex => " . $vec->to_Dec() . " " . $vec->to_Hex() . "\n"; my $vec2 = Bit::Vector->new_Hex(129, $hex); print "129 bits - $hex => " . $vec2->to_Dec() . " " . $vec->to_Hex() . "\n"; $vec2->MSB(1); print "129 bits - $hex => " . $vec2->to_Dec() . " " . $vec->to_Hex() . "\n"; OUTPUT: 128 bits - 966104526fe7d8baac32d27124a467b8 => -140394427096942342042315520958275491912 966104526FE7D8BAAC32D27124A467B8 129 bits - 966104526fe7d8baac32d27124a467b8 => 199887939823996121421059086473492719544 966104526FE7D8BAAC32D27124A467B8 129 bits - 966104526fe7d8baac32d27124a467b8 => -140394427096942342042315520958275491912 966104526FE7D8BAAC32D27124A467B8
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-14916-1248695195-750.39714-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <7BB8BF95A41BB042B5FFB96522BF4CFF2A4E5757F7 [...] ITDALEX06.it.maxim-ic.internal> <rt-3.6.HEAD-14916-1248695195-750.39714-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-14916-1248695386-581.39714-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 855
Download (untitled) / with headers
text/plain 855b
Sorry, there was a slight glitch in the code and output: CODE: #!perl -w use Bit::Vector; my $hex = '966104526fe7d8baac32d27124a467b8'; my $vec = Bit::Vector->new_Hex(128, $hex); print "128 bits - $hex => " . $vec->to_Dec() . " " . $vec->to_Hex() . "\n"; my $vec2 = Bit::Vector->new_Hex(129, $hex); print "129 bits - $hex => " . $vec2->to_Dec() . " " . $vec2->to_Hex() . "\n"; $vec2->MSB(1); print "129 bits - $hex => " . $vec2->to_Dec() . " " . $vec2->to_Hex() . "\n"; OUTPUT: 128 bits - 966104526fe7d8baac32d27124a467b8 => -140394427096942342042315520958275491912 966104526FE7D8BAAC32D27124A467B8 129 bits - 966104526fe7d8baac32d27124a467b8 => 199887939823996121421059086473492719544 0966104526FE7D8BAAC32D27124A467B8 129 bits - 966104526fe7d8baac32d27124a467b8 => -140394427096942342042315520958275491912 1966104526FE7D8BAAC32D27124A467B8
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-14916-1248695386-581.39714-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Charset: utf8
References: <7BB8BF95A41BB042B5FFB96522BF4CFF2A4E5757F7 [...] ITDALEX06.it.maxim-ic.internal> <rt-3.6.HEAD-14916-1248695195-750.39714-0-0 [...] rt.cpan.org> <rt-3.6.HEAD-14916-1248695386-581.39714-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Message-ID: <rt-3.6.HEAD-14916-1248699246-1162.39714-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 44
Sorry, this bug report is rejected (no bug).


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.