<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx</link><description>I've received some questions recently on how integer arithmetic works in VBScript, so I thought I might spend a few entries talking about some low-level bit twiddling topics. Here's one of the mails I got this morning: There seems to be a limitation on</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273415</link><pubDate>Thu, 02 Dec 2004 01:08:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273415</guid><dc:creator>Norman Diamond</dc:creator><description>&amp;gt; If you require integer arithmetic beyond 53&lt;br&gt;&amp;gt; bits [...] then you'll need to use special&lt;br&gt;&amp;gt; techniques.&lt;br&gt;&lt;br&gt;Such as, for example, programmatically fire up an instance of the Calculator accessory if your version of Windows is sufficiently recent, push input to it, and copy its output.&lt;br&gt;&lt;br&gt;&amp;gt; Developing libraries that manipulate&lt;br&gt;&amp;gt; arbitrarily large numbers efficiently is&lt;br&gt;&amp;gt; definitely character-building&lt;br&gt;&lt;br&gt;OK, instead of making a pun about which datatype is which (character-building vs. integer-building) (oops), I'll byte.  Microsoft did develop and deliver bignum arithmetic in the Calculator accessory, but not in a library for developers.  Did Microsoft really prioritize building character in non-Microsoft developers rather than in itself, or was this just a coincidence?</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273424</link><pubDate>Thu, 02 Dec 2004 01:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273424</guid><dc:creator>Eric Lippert</dc:creator><description>Funny, how fifty thousand people work here, and yet everyone externally seems to assume that everyone here knows what everyone else here was thinking at all times.&lt;br&gt;&lt;br&gt;Believe it or not, I haven't the faintest idea what the design decisions that went into calc.exe were.  I barely remember the design decisions that I made for my own product!&lt;br&gt;</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273551</link><pubDate>Thu, 02 Dec 2004 05:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273551</guid><dc:creator>BonzoESC</dc:creator><description>&amp;quot;Funny, how fifty thousand people work here, and yet everyone externally seems to assume that everyone here knows what everyone else here was thinking at all times. &amp;quot;&lt;br&gt;&lt;br&gt;B-B-But the nerds on slashdot kept calling you guys the Borg!  What happened to solidarity?  And unity?  United we stand, divided we fall!&lt;br&gt;&lt;br&gt;The #1 reason to comment your code is not for your future replacement, it's for your future self.</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273774</link><pubDate>Thu, 02 Dec 2004 16:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273774</guid><dc:creator>Tonetheman</dc:creator><description>Even though this is going on to a tangent... the problem that you speak of about lumping everyone at MS in solid brain clump is really just now coming to an end. Until all of the blogging started... effectively MS was one big brain clump, unless of course you knew someone or happened to know a newsgroup where one of you guys were posting.&lt;br&gt;&lt;br&gt;I still find myself lumping everyone at MS into a single evil clump. Though more and more I find that it is not true. And the blogs are changing that fact everyday. Whoever started the blog push at MS did a great job towards making MS more approachable. And hopefully has been rewarded.</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273859</link><pubDate>Thu, 02 Dec 2004 18:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273859</guid><dc:creator>Eric Lippert</dc:creator><description>It's an irony -- Microsoft is widely perceived as being a monolithic entity externally, and yet internally the #1 complaint on the company poll, year after year is &amp;quot;it is too hard to communicate effectively with other teams&amp;quot;.&lt;br&gt;&lt;br&gt;Microsoft is anything but a monolithic entity.  Rather, it's a loose-knit collection of disparate fiefdoms.  Some cooperate, some compete, it's a big old mess that takes someone as smart as Bill Gates to mold into some kind of vaguely coherent whole.</description></item><item><title>MS Blogs</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#273940</link><pubDate>Thu, 02 Dec 2004 20:58:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:273940</guid><dc:creator>BonzoESC</dc:creator><description>&amp;quot;I still find myself lumping everyone at MS into a single evil clump. Though more and more I find that it is not true. And the blogs are changing that fact everyday. Whoever started the blog push at MS did a great job towards making MS more approachable. And hopefully has been rewarded.&amp;quot;&lt;br&gt;&lt;br&gt;About half of my daily blog reads are MS - This one, Raymond Chen, and Major Nelson.  It's certainly teaching /me/ better habits.</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#274209</link><pubDate>Fri, 03 Dec 2004 08:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274209</guid><dc:creator>Mat Hall</dc:creator><description>&amp;quot;Developing libraries that manipulate arbitrarily large numbers efficiently is definitely character-building...&amp;quot;&lt;br&gt;&lt;br&gt;And then some!  Back in the dim and distant past I wrote a bunch of code in FORTRAN for just this purpose, and it was an interesting experience.  (For reasons unknown, the version of FORTRAN we used had the world's least precise floating point math routines, and anything longer than about 5 significant digits was useless.  For a supposedly math/engineering-centric language this was unhelpful...)</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#274475</link><pubDate>Fri, 03 Dec 2004 18:50:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274475</guid><dc:creator>Eric Brown</dc:creator><description>Mat:  If you need more than 5 significant digits in your engineering usage, you're not going to be able to build whatever it is you're simulating anyway.  &lt;br&gt;&lt;br&gt;Consider that resistors are typically +- 20%, unless you spend big bux and get the +- 1% (but then you need to worry about the inductance - precision resistors are often wirewound).  Capacitors are even worse.&lt;br&gt;&lt;br&gt;Civil engineering is way worse than that; typically, you'll be doing good to get one decimal point of accuracy.&lt;br&gt;&lt;br&gt;Of course, that's why civil engineers stick in about a 5x safety margin.&lt;br&gt;</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#274481</link><pubDate>Fri, 03 Dec 2004 18:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274481</guid><dc:creator>JP</dc:creator><description>Why the check for 32 bits and then for 16? Isn't (&amp;amp;h10000 - 1) = &amp;amp;hffff? I guess not since 65535 is not -1. Inherited problems from 16 bit world?&lt;br&gt;</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#274482</link><pubDate>Fri, 03 Dec 2004 18:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274482</guid><dc:creator>Eric Lippert</dc:creator><description>That's a somewhat specious analysis.  Engineering is about more than just multiplying mass times 9.8 to determine force.&lt;br&gt;&lt;br&gt;There are all kinds of engineering applications of mathematics which require high precision during the operation in order to get an answer that is within a couple significant digits of reality.&lt;br&gt;&lt;br&gt;Numeric solutions to differential equations, for example, are notorious for accumulating error terms.  The higher precision you can get the model, the less error is going to be introduced from the calculation.&lt;br&gt;</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#274483</link><pubDate>Fri, 03 Dec 2004 18:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:274483</guid><dc:creator>Eric Lippert</dc:creator><description>The interactions between 16 and 32 bit numbers can themselves be a little tricky; I should talk about those in another post.&lt;br&gt;</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#275400</link><pubDate>Mon, 06 Dec 2004 01:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:275400</guid><dc:creator>Norman Diamond</dc:creator><description>Also even though you can't build a machine to such tight tolerances, you can measure and make corrections until you can compute the necessary compensations (adjustments) to make in subsequent operations.  When your spacecraft takes off its speed is going to be more than 1% different from the ideal, but when you instruct it to use precious fuel for a midcourse correction you want your computations to be a lot closer than 1%.</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#7143299</link><pubDate>Thu, 17 Jan 2008 23:00:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7143299</guid><dc:creator>Jim Howell</dc:creator><description>&lt;p&gt;Eric--&lt;/p&gt;
&lt;p&gt;Thanks for posting the workaround. &amp;nbsp;We need to incorporate the ability to do these hex to dec and dec to hex conversions on very large numbers in order to convert MEID numbers (the new serial numbers issued by the FCC for cellular phones) in our database applications. &amp;nbsp;Just one real world example of people playing around with great big numbers! &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks --Jim&lt;/p&gt;
</description></item><item><title>re: Integer Arithmetic In VBScript, Part One</title><link>http://blogs.msdn.com/ericlippert/archive/2004/12/01/integer-arithmetic-in-vbscript-part-one.aspx#9835579</link><pubDate>Thu, 16 Jul 2009 15:58:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835579</guid><dc:creator>Jay Ohman</dc:creator><description>&lt;p&gt;Old blog, but still quite helpful. &amp;nbsp;Creating some IP range comparison math, it made sense (to me) to convert the dotted-octet address to decimal, then compare. &amp;nbsp;I ran into the &amp;quot;VBScript runtime error: Overflow&amp;quot; error for addresses beyond 127.255.255.255 (2^31-1) using Mod. &amp;nbsp;Since I needed Mod for addresses up to 255.255.255.255 (2^32-1), I was thwarted by 1 bit! &amp;nbsp;Thankfully, the workaround was posted.&lt;/p&gt;
</description></item></channel></rss>