导航:
论坛 -> DELPHI技术
斑竹:liumazi,sephil
作者:
2020/11/30 15:08:50
标题:
加入我的收藏
楼主:
i64TB := 1024 * 1024 * 1024 * 1024; // 1099511627776 求大神..
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
2020/11/30 15:18:49
1楼:
问 F1 HELP
----------------------------------------------
(C)(P)Flying Wang
作者:
2020/11/30 15:19:11
2楼:
INT64或者UINT64有啥问题吗?
----------------------------------------------
-
作者:
2020/11/30 15:27:17
3楼:
@scarlette [dcc32 Error] funx.pas(530): E2099 Overflow in conversion or arithmetic operation
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
2020/11/30 15:34:59
4楼:
i64TB := UInt64(1024 * 1024 * 1024) * 1024; // 1099511627776 居然这样才能编译通过。
----------------------------------------------
(C)(P)Flying Wang
作者:
2020/11/30 15:37:28
4楼:
我擦……常量表达式默认是按照INT32类型看待的好吧…… i64TB := UINT64(1048576) * UINT64(1048576); 这样就可以了,我懒得写4个UINT64(1024),你要改自己改一下吧。 你问题也不写清楚,别人猜起来很费劲儿的……-__-#
----------------------------------------------
-
作者:
2020/11/30 16:03:49
5楼:
1024 * 1024 * 1024 * 1024; 晕, 不能写4个表达式? 那我用计算器把值弄出来, 赋上得了.. delphi 这应该叫bug吧.
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
2020/12/1 0:50:57
6楼:
这个真不算是Bug,常量表达式(以及其中各项子表达式)的默认推定类型是INT32。Delphi对此的Type Promotion的规则非常死板的,表达式中间步骤里,除非算符两侧至少有一个项已经推定为INT/UINT64,否则不会突破32Bit边界。别问我为啥会有这种操蛋的规则,我也不知道,很多C++编译器也这个尿性……
----------------------------------------------
-
作者:
2020/12/1 1:09:14
7楼:
嗯……仔细想了想,好像要说是Bug也行,但这貌似又是很多SSA型编译器的通病……_(:_」∠)_
----------------------------------------------
-
作者:
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
作者:
2020/12/1 16:13:20
9楼:
var lMyTByte:UINT64; begin lMyTByte := 1024 * 1024 * 1024 * 1024; 报错了...
----------------------------------------------
delphi界写python最强, python界写delphi最强. 写自己的代码, 让别人去运行.
作者:
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
作者:
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