Home > Back-end >  Why is negative Int64 calculations?
Why is negative Int64 calculations?

Time:09-30

 
Procedure TForm1. Btn1Click (Sender: TObject);
Var
IntX1 intX2, intX: Int64;
IntA intb.br deal, a steady, intD: Int64;
The begin
IntA:=256 * 256;
Intb.br deal:=256 * 256;
Id:=256 * 256;
IntD:=256 * 255;
IntX1:=intA * intb.br deal;
IntX2: id=* intD;
IntX:=intX1 * intX2;
Showmessage (inttostr (intX));
end;


CodePudding user response:

Results in excess of the 64 most dazheng integer ceiling, becomes negative
Please use type double

CodePudding user response:

Int64: is the largest integer in Delphi, a 64 - bit signed integer
Type Int64=- 9223372036854775808.. 9223372036854775807;
When data cross-border (& gt; 9223372036854775807), retain only after a 64 - bit data, false phenomenon,

Your IntX value is more than 9223372036854775807, the result of crossing the line is the appearance of a negative number,

CodePudding user response:

Exceeds the ceiling, round the whole well in negative territory,

CodePudding user response:

It is no use value is too large, with a Double

CodePudding user response:

7, 256, 1 255, seems to be 2 ^ 63 times, should be just enough,,,,,,,

CodePudding user response:

reference 5 floor sz_haitao reply:
7, 256, 1 255, seems to be 2 ^ 63 times, should be just enough,,,,,,,


It should be 7, 256, 1 128, is 2 ^ 63 times

CodePudding user response:

SSSSSD

refer to 6th floor sz_haitao response:
Quote: refer to the fifth floor sz_haitao reply:

7, 256, 1 255, seems to be 2 ^ 63 times, should be just enough,,,,,,,


Should be 7, 256, 1 128, is 2 ^ 63 times


7, 256, 1 128 show is negative

CodePudding user response:

Do you have any unsigned 64 - bit data type?

CodePudding user response:

The number 176892884410642042440,
Is greater than the maximum number of Int64, 9223372036854775807,

CodePudding user response:

Very modest, the results should be=18374686479671623680

CodePudding user response:

refer to 7th floor seleron response:
SSSSSD

Quote: refer to the sixth floor sz_haitao response:

Quote: refer to the fifth floor sz_haitao reply:

7, 256, 1 255, seems to be 2 ^ 63 times, should be just enough,,,,,,,


Should be 7, 256, 1 128, is 2 ^ 63 times


7, 256, 1 128 display is also negative

2 ^ 63-1 is the largest integer
More than 1, became a negative number

CodePudding user response:

11 references sz_haitao response:
Quote: refer to 7th floor seleron response:

SSSSSD

Quote: refer to the sixth floor sz_haitao response:

Quote: refer to the fifth floor sz_haitao reply:

7, 256, 1 255, seems to be 2 ^ 63 times, should be just enough,,,,,,,


Should be 7, 256, 1 128, is 2 ^ 63 times


7, 256, 1 128 display is also negative

2 ^ 63-1 is the largest integer
Become a negative number more than 1


Delphi the most-positive integer should be 2 ^ 32-1

CodePudding user response:

Wrong
Delphi is the most dazheng integer should be in 2 ^ 63-1

CodePudding user response:

How to said more than 9223372036854775807 in Delphi 2 ^ 63-1 number?

CodePudding user response:

On the 14th floor seleron
reference response:
how to represent in the Delphi is greater than the number 9223372036854775807 is 2 ^ 63-1?


Yourself or the third party to achieve any digits of the integer class,,,,

Seemed to go or python's built-in, probably the latter

CodePudding user response:

On the 14th floor seleron
reference response:
how to represent in the Delphi is greater than the number 9223372036854775807 is 2 ^ 63-1?

Two 64 - bit integer number,

CodePudding user response:

Compile, greater than 2 ^ 63-1 integer, can through the String character types, in the form of characters stored in the database, or two fields are saved: A field holds an integer 10 ^ 18 integer, B field holds more than 10 ^ 19 integers,

CodePudding user response:

UIntToStr

CodePudding user response:

With a uint64

CodePudding user response:

The
references the 19th floor DelphiGuy response:
with uint64


D7 haven't

But is only a big one,,,,

CodePudding user response:

For just enough of the building Lord,
  • Related