ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl5-porters
perl5-porters
Re: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle
by John Peacock other posts by this author
Jul 24 2001 3:14PM messages near this date
Re: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle | [PATCH bleadperl os2/perlrexx.c] my C compiler has no HTML parser
"Miller, Scott L" wrote:
>  
>  > -----Original Message-----
>  > From: Nicholas Clark [mailto:nick@[...].org]
>  >
>  > Not sure if this is a sane idea. Can you
>  >
>  > define the width of a negative integer to be the smallest
>  > number of bits
>  > needed to represent it in 2s complement.
>  > So -9 (ie 1111111111110111) is 10111 (width 5)
>  >
>  >    -6 (ie 1111111111111010) is 1010 (width 4)
>  >
>  > -6 & -9 needs to promote -6 to width 5, [same as positive
>  > case] but do the
>  > promotion as sign extension (11010) then & the two together
>  >
>  > 11010 & 10111 == 10010
>  >
>  > which is -14. And gives the same answer as 16 bit and 32 bit
>  > fixed precision,
>  > as best I can tell.
>  >
>  > [not tested very much for other values or for | or ^ operators]
>  >
>  > Nicholas Clark
>  
>  How would you be able to tell if the number was intended to be negative?
>  11010 = -6 or 26, 10111 = -9 or 23...
>  
>  -Scott

All discussion of binary notation is pointless; BigInt's are stored as 
an array of Base-10**7 numbers.  We have to figure out how to handle 
the logical operators in a sane fashion with unlimited length integers
stored in a completely non-binary fashion.

Anyone with me that we should deprecate the logicals in M::BI completely 
and point people at Bit::Vector if they want to do unlimited length 
boolean math!

John

--
John Peacock
Director of Information Research and Technology
Rowman & Littlefield Publishing Group
4720 Boston Way
Lanham, MD 20706
301-459-3366 x.5010
fax 301-429-5747
Thread:
Miller, Scott L

John Peacock

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved