?
Solved

Int64 Constants Range

Posted on 2001-07-22
4
Medium Priority
?
1,397 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 17

Accepted Solution

by:
inthe earned 50 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 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