Solved

Int64 Constants Range

Posted on 2001-07-22
4
1,364 Views
Last Modified: 2012-06-27

I wonder why Delphi will not allow me to input this number in my source code (as a constant):

i := -9223372036854775808;

"i" is defined as a Int64 and should actually be able to hold this value! Most remarkable is that this works though:

i := -9223372036854775807-1;
ShowMessage(IntToStr(i));

And this code also displays exactly the number I could not enter?! So appearantly Delphi programs can handle this large negative number, but the IDE will not allow you to enter them?

Am I missing something here? I think this is weird?!

I'm not stuck or anything, my program works but.. I just wonder if anyone knows *why* Delphi behaves like this??


/m
0
Comment
Question by:requiem
4 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 25 total points
ID: 6306587
strange ,you can also do it this way:

const
i : int64 =low(int64);
begin
showmessage(inttostr(i));

0
 
LVL 5

Expert Comment

by:scrapdog
ID: 6306687
I would think that the error is in the parser...maybe the parser only allows the 19th digit in int64 literals to be <= 7 (instead of 7 for positive and 8 for negative).
0
 
LVL 1

Author Comment

by:requiem
ID: 6379813
I guess this one will be unsolved.
0
 
LVL 1

Expert Comment

by:vissim
ID: 22763027
Did you test iint64tostr( )    function ?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now