<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://ubersoft.org/Sputnik/wiki/skins/common/feed.css?301"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_DiffCalc</id>
		<title>Core Function DiffCalc - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://ubersoft.org/Sputnik/wiki/index.php?action=history&amp;feed=atom&amp;title=Core_Function_DiffCalc"/>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_DiffCalc&amp;action=history"/>
		<updated>2026-04-04T22:51:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.17.0</generator>

	<entry>
		<id>http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_DiffCalc&amp;diff=5831&amp;oldid=prev</id>
		<title>UberFoX: Created page with &quot;&lt;pre&gt; DiffCalc( &lt;first&gt;, &lt;second&gt;, &lt;useDouble&gt; ) &lt;/pre&gt;  === Description ===  Calculate the difference between two values and return the diff type Same/Add/Sub with a raw diff wh...&quot;</title>
		<link rel="alternate" type="text/html" href="http://ubersoft.org/Sputnik/wiki/index.php?title=Core_Function_DiffCalc&amp;diff=5831&amp;oldid=prev"/>
				<updated>2015-09-04T21:59:29Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; DiffCalc( &amp;lt;first&amp;gt;, &amp;lt;second&amp;gt;, &amp;lt;useDouble&amp;gt; ) &amp;lt;/pre&amp;gt;  === Description ===  Calculate the difference between two values and return the diff type Same/Add/Sub with a raw diff wh...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
DiffCalc( &amp;lt;first&amp;gt;, &amp;lt;second&amp;gt;, &amp;lt;useDouble&amp;gt; )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description ===&lt;br /&gt;
&lt;br /&gt;
Calculate the difference between two values and return the diff type Same/Add/Sub with a raw diff which can be added to the base value to make it become the second and a non-raw diff that must be added or subbed for first to become second&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
==== first ====&lt;br /&gt;
&lt;br /&gt;
The first value to calculate (source value).&lt;br /&gt;
&lt;br /&gt;
==== second ====&lt;br /&gt;
&lt;br /&gt;
The second value to calculate (destination value).&lt;br /&gt;
&lt;br /&gt;
==== useDouble ====&lt;br /&gt;
&lt;br /&gt;
Optional; If TRUE then the calculation will be made using Double instead of Int64&lt;br /&gt;
&lt;br /&gt;
Default: False&lt;br /&gt;
&lt;br /&gt;
=== Return Value === &lt;br /&gt;
&lt;br /&gt;
Success: A three element array with the following:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[0] = Type (Same/Add/Sub)&lt;br /&gt;
[1] = Difference (to be used with Type so if type if Sub you -= the difference &lt;br /&gt;
[2] = Raw Difference can be applied directly to the first value with += or -=&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Remarks === &lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;sputnik&amp;quot;&amp;gt;&lt;br /&gt;
// get a diff on double using the double flag&lt;br /&gt;
PrintDiff(100.0, 50.0, true);&lt;br /&gt;
// now get the diff on some ints&lt;br /&gt;
PrintDiff(0x411C88, 0x40230F);&lt;br /&gt;
PrintDiff(0x40230F, 0x411C88);&lt;br /&gt;
&lt;br /&gt;
Function PrintDiff($first, $second)&lt;br /&gt;
{&lt;br /&gt;
	// Get the diff&lt;br /&gt;
	my List($Type, $Diff, $RawDiff) = DiffCalc($first, $second);&lt;br /&gt;
	// Print its info&lt;br /&gt;
	say &amp;quot;Type: $Type | Diff: $Diff | RawDiff: $RawDiff&amp;quot;;&lt;br /&gt;
	// To make the second from first we do&lt;br /&gt;
	my $remade = $first + $RawDiff;&lt;br /&gt;
	say &amp;quot;Remade: &amp;quot; . $remade . &amp;quot; | InHex: &amp;quot; . Hex($remade);&lt;br /&gt;
}&lt;br /&gt;
// PRINTS&lt;br /&gt;
// Type: Sub | Diff: 50 | RawDiff: -50&lt;br /&gt;
// Remade: 50 | InHex: 32&lt;br /&gt;
// Type: Sub | Diff: 63865 | RawDiff: -63865&lt;br /&gt;
// Remade: 4203279 | InHex: 40230F&lt;br /&gt;
// Type: Add | Diff: 63865 | RawDiff: 63865&lt;br /&gt;
// Remade: 4267144 | InHex: 411C88&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Core Function]]&lt;/div&gt;</summary>
		<author><name>UberFoX</name></author>	</entry>

	</feed>