Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Re: Mysterious Range Check Error... Help plz!!! Posted by quikcarlx on 22 Oct 2012 at 6:10 PM
It's not that mysterious if you read the definition for the trunc function and what it returns. I took things by step to see where the Range Check Error is coming from. And when I changed the definition of x to int64, it worked! Here's what I did to find the error.
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.

Thread Tree
blackr12345 Mysterious Range Check Error... Help plz!!! on 21 Oct 2012 at 11:46 AM
quikcarlx Re: Mysterious Range Check Error... Help plz!!! on 22 Oct 2012 at 6:10 PM
blackr12345 Re: Mysterious Range Check Error... Help plz!!! on 13 Nov 2012 at 11:48 PM



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.