Solved

Int64 Constants Range

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

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

Suggested Solutions

Title # Comments Views Activity
Print Graphic and Text to Epson TM-T88v 12 538
URL for downloading Google Chrome for Win XP 2 270
select query - oracle 16 103
How to build JSON File in Delphi 6 3 89
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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