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 other posts by this author
Jul 24 2001 5:22PM messages near this date
RE: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle | Re: [ID 20010723.001] perl 5.6.1: BigInt booleans cannot handle
"Miller, Scott L" <Scott.L.Miller@[...].com>  wrote:
:>  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.
[...]
:How would you be able to tell if the number was intended to be negative?
:11010 = -6 or 26, 10111 = -9 or 23...

You always know from looking at the arguments: define sgn(x) as 0 for
positive and 1 for negative, and sgn(result) = sgn(left) op sgn(right)
does the right thing.

Hugo
Thread:
Miller, Scott L

John Peacock

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