var
  d: Double;
begin
   d := 10000000000.0;
   d := Sqr(d);
   d := Trunc(d);
end;
上述代码在D5和D7上运行,都会产生异常
各位试试,哪位大侠能给出解释,万分谢谢!!

解决方案 »

  1.   

    Int64 -2^63..2^63-1 signed 64-bit
    If the truncated value of X is not within the Int64 range, an EInvalidOp exception is raised. 
    delphi的帮助,d的值太大了,int64放不下。
      

  2.   

    function Trunc(X: Extended): Int64;
    这个应该和编译器没有关系,
    返回值是int64,如果X超过int64的范围就会引发EInvalidOp exception。
      

  3.   

    function Trunc(X: Extended): Int64;DescriptionThe Trunc function truncates a real-type value to an integer-type value. X is a real-type expression. Trunc returns an Int64 value that is the value of X rounded toward zero.If the truncated value of X is not within the Int64 range, an EInvalidOp exception is raised.