|
From: Eric <eri...@cl...> - 2003-10-08 22:10:49
|
good its gone from 13K to 7K "WITH MORE TEXT ADDED" this could the UK tax system VAT "Value Added Text" ----- Original Message ----- From: <age...@co...> To: "Eric" <eri...@cl...> Sent: Thursday, October 09, 2003 11:02 AM Subject: Re: [Dev-C++] (no subject) HTML e-mails suck unless you need to post graphics inside your e-mail, need a ton of hyperlinks, or are making a newsletter. If you need pictures or hyperlinks, use AIM! -- ~~Scott Simontis~~ Programmer > this "dorkie black font on white HTML Email" came in at 13K in > file size > I have converted it to plain text email you will notice the drop in file > size, yet looks just the same as the original email "black font on > white" > > for more reading > http://www.georgedillon.com/web/html_email_is_evil.shtml (7 REASONS > WHY HTML E-MAILS ARE EVIL.) > > > > ----- Original Message ----- > From: David McKen > To: Dev-Cpp Mailing List > Sent: Wednesday, October 08, 2003 4:19 PM > Subject: [Dev-C++] (no subject) > > > Ok how are overflows handled in C++ for integer types? > I know about the resulting (number % upper_limit) effect which is > actually what I want. What I am interested in is determining that an > overflow has occurred. > So far my searches into the void ... whoops meant the C++ standard, seem > to suggest a exception is thrown when a overflow occurs, however I am > under the impression exceptions are not exactly completely portable just > yet, or am I wrong in this belief? The code makes use of classes so I am > fairly confident that exceptions are portably supported the question is > whether the exception is thrown for this exception. The following chunk > of the standard should explain why I am not too sure about this. > -- Begin Quote -- > [Note: operators can be regrouped according to the usual mathematical > rules only where the operators really > are associative or commutative.9) For example, in the following fragment > int a, b; > /*...*/ > a = a + 32760 + b + 5; > the expression statement behaves exactly the same as > a = (((a + 32760) + b) + 5); > due to the associativity and precedence of these operators. Thus, the > result of the sum (a + 32760) is > next added to b, and that result is then added to 5 which results in the > value assigned to a. On a machine in > which overflows produce an exception and in which the range of values > representable by an int is > [- 32768,+32767], the implementation cannot rewrite this expression as > a = ((a + b) + 32765); > since if the values for a and b were, respectively, - 32754 and - 15, > the sum a + b would produce an > exception while the original expression would not; nor can the > expression be rewritten either as > a = ((a + 32765) + b); > or > a = (a + (b + 32765)); > since the values for a and b might have been, respectively, 4 and - 8 > or - 17 and 12. However on a > machine in which overflows do not produce an exception and in which the > results of overflows are > reversible, the above expression statement can be rewritten by the > implementation in any of the above ways > because the same result will occur. ] > > -- End Quote -- > This seems to indicate that the overflow is only thrown on machines that > produce some sort of exception when an overflow occurs. Also a similar > exception class exist for underflows the structure seems to be extremely > similar to the overflow, I assume if one works then so does the other. > Also is there some mathematical way to detect such an overflow? So far I > am not finding any way, as the result can potentially be anywhere within > the full range of numbers represent by the data type. I would rather not > try to determine if an overflow would occur by performing the addition > myself in binary as I am exploring this method to try to increase the > efficiency of my algorithm and doing the addition "by hand" would > severely increase the complexity of my algorithm. > Thanks in Advance > David McKen > P.S. In case you are wondering this is not homework but a BigInt class I > am trying to create. > > > Do you Yahoo!? > The New Yahoo! Shopping - with improved product search > > > > ------------------------------------------------------- > 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 |