Re: [Dev-C++] Overflow detection (was No Subject)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: David M. <ci...@ya...> - 2003-10-09 22:21:49
|
Ok, point taken. I am not going to stop though. For me this is another of my personal projects that help me learn. Guess I will point them towards GMP and the Large Number class on sourceforge.net (a class I am fighting to understand as I see alot of pre-processor directives). No assembly! I am fighting for portability, asm is one of the fastest ways to break that portability. Damn, I am such an idiot. That would work extremly well! Thanks! The only difference is I add the overflow to the next block. The only bit I was worrying about was the carry bit. Thanks Per Signed David McKen ----- Original Message ----- From: "Per Westermark" <pw...@ia...> To: "David McKen" <ci...@ya...> Cc: "Dev-C Mailing List" <dev...@li...> Sent: Thursday, October 09, 2003 9:57 AM Subject: Re: [Dev-C++] Overflow detection (was No Subject) > Are you also sick of the existing large-number libraries that exists, and > that supports any number of digits up to size of available memory? > > To my knowledge, you can't write a portable implementation using > overflow exceptions. The normal method is for example to perform all > big-number arithmetic with unsigned numbers and a separately stored sign > bit. > > Then you get: > > r0 = a0 + b0; > overflow = r0 < a0 || r0 < b0; > r1 = a1 + b1 + overflow; > .. > > No need to work on bit level. > > If implemented in assembly, the > overflow = r0 < a0 || r0 < b0 > can be ignored, since an overflow would result in the carry bit being set > in the processor flag register - all processors have support for carry > bit. > > /Per W > > On Thu, 9 Oct 2003, David McKen wrote: > > > No I don't require it to be standard, however I would like > > it to be standard. > > > > My current focus are speed and portability. The reason why > > 64 bit won't sufice is because I would like to take a try > > at the RSA factoring challenge: > > > > http://www.rsasecurity.com/rsalabs/challenges/factoring/faq.html > > > > And if you look throught you will eventually find the > > challenge numbers at > > > > http://www.rsasecurity.com/rsalabs/challenges/factoring/numbers.html > > > > IF you take a look at those numbers then you will quickly > > see why 64 bit is too small. Besides if I complete this > > class I know at least 3-4 people who would use it because > > they are sick of the 4 billlion limitation put on them. > > > > Thanks for your Help > > > > Signed > > David McKen > > > > __________________________________ > > Do you Yahoo!? > > The New Yahoo! Shopping - with improved product search > > http://shopping.yahoo.com > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. > > SourceForge.net hosts over 70,000 Open Source Projects. > > See the people who have HELPED US provide better services: > > Click here: http://sourceforge.net/supporters.php > > _______________________________________________ > > Dev-cpp-users mailing list > > Dev...@li... > > TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm > > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > > > __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |