<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Mysterious Range Check Error... Help plz!!!' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Mysterious Range Check Error... Help plz!!!' posted on the 'Pascal' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 18 May 2013 10:13:11 -0700</pubDate>
    <lastBuildDate>Sat, 18 May 2013 10:13:11 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Mysterious Range Check Error... Help plz!!!</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429904/429904/mysterious-range-check-error-help-plz/</link>
      <description>I dry ran these codes for hours but I couldn't find a solution to the Range Check Error.&lt;br /&gt;
&lt;br /&gt;
The compiler I am using is FreePascal 2.6.&lt;br /&gt;
&lt;br /&gt;
Please help. Thank you in advance.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program abc;

uses math;

var x: integer;

begin

x:= trunc(power(10, 2/log10(2)));

readln
end.&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429904/429904/mysterious-range-check-error-help-plz/</guid>
      <pubDate>Sun, 21 Oct 2012 11:46:56 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Mysterious Range Check Error... Help plz!!!</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429904/429910/re-mysterious-range-check-error-help-plz/#429910</link>
      <description>It's not that mysterious if you read the definition for the &lt;span style="color: Green;"&gt;trunc&lt;/span&gt; function and what it returns.  I took things by step to see where the &lt;span style="color: Red;"&gt;Range Check Error&lt;/span&gt; is coming from.  And when I changed the definition of x to &lt;span style="color: Green;"&gt;int64&lt;/span&gt;, it worked!  Here's what I did to find the error.&lt;br /&gt;
&lt;pre class="sourcecode"&gt;program abc;

  uses math;

  var
    x : int64;
    lv : float;
    pv : float;
    tv : float;

begin
  lv := 2 / log10( 2 );
  pv := power( 10, lv );
  tv := trunc( pv );
  writeln( lv:12:6,'  ', pv:12:6, '  ', tv:12:6 );

  x := trunc(power(10, 2/log10(2)));
  writeln( x:12 );

  readln
end.&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429904/429910/re-mysterious-range-check-error-help-plz/#429910</guid>
      <pubDate>Mon, 22 Oct 2012 18:10:54 -0700</pubDate>
      <category>Pascal</category>
    </item>
    <item>
      <title>Re: Mysterious Range Check Error... Help plz!!!</title>
      <link>http://www.programmersheaven.com/mb/pasprog/429904/430250/re-mysterious-range-check-error-help-plz/#430250</link>
      <description>Thank you so much!!!&lt;br /&gt;
Choosing the correct data type is so hard for me~&lt;br /&gt;
&lt;br /&gt;
btw, sorry for my late reply which is due to a login problem :(&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/pasprog/429904/430250/re-mysterious-range-check-error-help-plz/#430250</guid>
      <pubDate>Tue, 13 Nov 2012 23:48:19 -0700</pubDate>
      <category>Pascal</category>
    </item>
  </channel>
</rss>