Solved

Int64 Constants Range

Posted on 2001-07-22
4
1,356 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

9 Experts available now in Live!

Get 1:1 Help Now