Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Int64 Constants Range

Posted on 2001-07-22
4
Medium Priority
?
1,405 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 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