DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: laidabin
今日帖子: 6
在线用户: 30
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 tuesdays (Tuesday) ▲▲▲▲△ -
普通会员
2020/11/30 15:08:50
标题:
i64TB 应该设置什么类型? 浏览:1095
加入我的收藏
楼主: i64TB := 1024 * 1024 * 1024 * 1024;  // 1099511627776

求大神..
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
男 wang_80919 (Flying Wang) ★☆☆☆☆ -
普通会员
2020/11/30 15:18:49
1楼: 问 F1 HELP
----------------------------------------------
(C)(P)Flying Wang
作者:
男 scarlette (Scarlette) ★☆☆☆☆ -
普通会员
2020/11/30 15:19:11
2楼: INT64或者UINT64有啥问题吗?
----------------------------------------------
-
作者:
男 tuesdays (Tuesday) ▲▲▲▲△ -
普通会员
2020/11/30 15:27:17
3楼: @scarlette

[dcc32 Error] funx.pas(530): E2099 Overflow in conversion or arithmetic operation
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
男 wang_80919 (Flying Wang) ★☆☆☆☆ -
普通会员
2020/11/30 15:34:59
4楼: i64TB := UInt64(1024 * 1024 * 1024) * 1024;  // 1099511627776
居然这样才能编译通过。
----------------------------------------------
(C)(P)Flying Wang
作者:
男 scarlette (Scarlette) ★☆☆☆☆ -
普通会员
2020/11/30 15:37:28
4楼: 我擦……常量表达式默认是按照INT32类型看待的好吧……

i64TB := UINT64(1048576) * UINT64(1048576);
这样就可以了,我懒得写4个UINT64(1024),你要改自己改一下吧。

你问题也不写清楚,别人猜起来很费劲儿的……-__-#
----------------------------------------------
-
作者:
男 tuesdays (Tuesday) ▲▲▲▲△ -
普通会员
2020/11/30 16:03:49
5楼: 1024 * 1024 * 1024 * 1024;

晕, 不能写4个表达式?  那我用计算器把值弄出来, 赋上得了.. 
delphi 这应该叫bug吧.
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
男 scarlette (Scarlette) ★☆☆☆☆ -
普通会员
2020/12/1 0:50:57
6楼: 这个真不算是Bug,常量表达式(以及其中各项子表达式)的默认推定类型是INT32。Delphi对此的Type Promotion的规则非常死板的,表达式中间步骤里,除非算符两侧至少有一个项已经推定为INT/UINT64,否则不会突破32Bit边界。别问我为啥会有这种操蛋的规则,我也不知道,很多C++编译器也这个尿性……
----------------------------------------------
-
作者:
男 scarlette (Scarlette) ★☆☆☆☆ -
普通会员
2020/12/1 1:09:14
7楼: 嗯……仔细想了想,好像要说是Bug也行,但这貌似又是很多SSA型编译器的通病……_(:_」∠)_
----------------------------------------------
-
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2020/12/1 14:13:50
8楼: try define a var as UINT64 and later, assing the new value

var
  lMyTByte:UINT64;
begin
  lMyTByte := 1024 * 1024 * 1024 * 1024;  // 1099511627776

or

  lMyTByte := UINT64(...);
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 tuesdays (Tuesday) ▲▲▲▲△ -
普通会员
2020/12/1 16:13:20
9楼: var
  lMyTByte:UINT64;
begin
  lMyTByte := 1024 * 1024 * 1024 * 1024;

报错了...
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2020/12/2 5:37:56
10楼: Rudy blog about BigInteger library

http://rvelthuis.de/programs/bigintegers.html
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
作者:
男 emailx45 (emailx45) ▲▲▲▲△ -
普通会员
2020/12/2 5:44:14
11楼: procedure TForm1.Button1Click(Sender: TObject);
var
  lMyTByte:UINT64;
begin
  lMyTByte := UINT64(1024 * 1024) * UINT64(1024 * 1024);  // 1099511627776
  //
  Caption := lMyTByte.ToString;
end;


按此在新窗口浏览图片
----------------------------------------------
The higher the degree, the greater the respect given to the humblest!RAD 11.3
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行74.21875毫秒 RSS