<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://gswiki-archive.gs-game.uk/index.php?action=history&amp;feed=atom&amp;title=Trunc</id>
	<title>Trunc - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://gswiki-archive.gs-game.uk/index.php?action=history&amp;feed=atom&amp;title=Trunc"/>
	<link rel="alternate" type="text/html" href="https://gswiki-archive.gs-game.uk/index.php?title=Trunc&amp;action=history"/>
	<updated>2026-11-11T23:45:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://gswiki-archive.gs-game.uk/index.php?title=Trunc&amp;diff=15636&amp;oldid=prev</id>
		<title>imported&gt;ZHOUY1: how to use the wiki expression parser</title>
		<link rel="alternate" type="text/html" href="https://gswiki-archive.gs-game.uk/index.php?title=Trunc&amp;diff=15636&amp;oldid=prev"/>
		<updated>2018-05-31T21:50:27Z</updated>

		<summary type="html">&lt;p&gt;how to use the wiki expression parser&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Truncation&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;trunc&amp;#039;&amp;#039;&amp;#039; is a mathematical term that appears frequently in [[GemStone IV]] equations that do everything from figuring out a character&amp;#039;s [[mana point]] total to how many [[premium point]]s it costs to [[enchant]] an item.&lt;br /&gt;
&lt;br /&gt;
To truncate a number, remove all decimal places after the whole number (integer) without rounding.  Thus, 6.1 and 6.9 would both be 6 when truncated.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Total premium points required for enchanting plain item (+5 added) with a starting enchant bonus of +16 to +45:&lt;br /&gt;
&lt;br /&gt;
:{{math|1200 + (400 * trunc((current plus - 11) / 5)))}}&lt;br /&gt;
&lt;br /&gt;
For this example we&amp;#039;ll use a &amp;quot;current plus&amp;quot; of 20 (the item is standard 4x enchanted).&lt;br /&gt;
&lt;br /&gt;
:{{math|1200 + (400 * trunc((20 - 11) / 5))) {{=}} 1200 + (400 * trunc(9/5)) {{=}} 1200 + (400 * &amp;#039;&amp;#039;&amp;#039;trunc(1.8)&amp;#039;&amp;#039;&amp;#039;) {{=}} 1200 + (400 * 1) {{=}} 1200 + 400 {{=}} &amp;#039;&amp;#039;&amp;#039;1600&amp;#039;&amp;#039;&amp;#039;}}&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Trunc to 0.xx&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
In some formulas, instead of truncating to a whole number, values may be truncated to {{math|&amp;#039;&amp;#039;n&amp;#039;&amp;#039;}} digits after the decimal point. In mathematical terms this is the {{math|trunc(&amp;#039;&amp;#039;x&amp;#039;&amp;#039;, &amp;#039;&amp;#039;n&amp;#039;&amp;#039;)}} function. On the wiki this may also be described as &amp;quot;{{math|trunc to 0.XX}}&amp;quot; for 2 digits, etc.&lt;br /&gt;
&lt;br /&gt;
== Wiki Expressions ==&lt;br /&gt;
&lt;br /&gt;
GSWiki supports inline expression parsing using &amp;lt;code&amp;gt;trunc&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#expr: trunc(1.234)}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; produces {{#expr: trunc(1.234)}}&lt;br /&gt;
*&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{#expr: trunc(1.234 * 100) / 100}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; produces {{#expr: trunc(1.234 * 100) / 100}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Truncation Truncation] on Wikipedia&lt;br /&gt;
&lt;br /&gt;
[[category:Real Life]]&lt;/div&gt;</summary>
		<author><name>imported&gt;ZHOUY1</name></author>
	</entry>
</feed>