Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Using the Lazarus IDE
»
General
»
Lazarus appear to wrong arithmetic operations with big nums.
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Purpose of TProcessUTF8
by
LemonParty
[
Today
at 06:16:09 pm]
Saving a workbook with mu...
by
Kaljakoira
[
Today
at 06:06:45 pm]
[Solved] Set TSpeedButton...
by
jcmontherock
[
Today
at 04:08:22 pm]
[SOLVED] Set horizontal s...
by
rvk
[
Today
at 03:57:47 pm]
Questions about TFuncSeri...
by
hedgehog
[
Today
at 03:50:00 pm]
Hello! Anything new?
by
Nimbus
[
Today
at 01:51:43 pm]
could Ardour's YTK be use...
by
robert rozee
[
Today
at 01:37:44 pm]
How many lines is too man...
by
440bx
[
Today
at 12:51:24 pm]
[revisited] triple click
by
dbannon
[
Today
at 12:27:18 pm]
Update a table with an Au...
by
Zvoni
[
Today
at 12:22:58 pm]
The growth of computers
by
marcov
[
Today
at 10:12:39 am]
Configuration issues rega...
by
Martin_fr
[
Today
at 08:05:38 am]
[SOLVED] TCP/IP Question
by
valdir.marcos
[
Today
at 05:03:12 am]
Update fpexprpars
by
valdir.marcos
[
Today
at 04:52:27 am]
C/C++ code to Object Pasc...
by
Curt Carpenter
[
Today
at 03:58:28 am]
Win 11, strange position ...
by
d7_2_laz
[March 08, 2026, 11:13:04 pm]
Lazarus for Windows on aa...
by
msintle
[March 08, 2026, 09:23:01 pm]
Lazarus Bugfix Release 4....
by
Martin_fr
[March 08, 2026, 08:17:00 pm]
Debian removes FPC/Lazaru...
by
Schmitty2005
[March 08, 2026, 07:56:33 pm]
[SOLVED] ??? I don't even...
by
n7800
[March 08, 2026, 07:29:19 pm]
how to rename/save a seco...
by
valdir.marcos
[March 08, 2026, 07:25:59 pm]
How to run an external co...
by
valdir.marcos
[March 08, 2026, 07:07:31 pm]
Qt6/Wayland clipboard: pa...
by
Fred vS
[March 08, 2026, 07:02:05 pm]
NIL vs. Assign: when to u...
by
valdir.marcos
[March 08, 2026, 06:22:05 pm]
lazarus in new england
by
valdir.marcos
[March 08, 2026, 06:10:02 pm]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Lazarus appear to wrong arithmetic operations with big nums. (Read 5306 times)
Tommi
Sr. Member
Posts: 256
Lazarus appear to wrong arithmetic operations with big nums.
«
on:
November 19, 2007, 09:50:05 pm »
This simple code returns 148321786 and not 87956783576570.
I need it for crc64 operations.
Some idea ?
Thank You
procedure TForm1.Button2Click(Sender: TObject);
var
CRC64:TCRC64;
P:pointer;
a,b:integer;
x:int64;
begin
a:=8795678357657;b:=0;
edit1.Text:=inttostr(a*10);
end;
Logged
cyber_python
Jr. Member
Posts: 79
RE: Lazarus appear to wrong arithmetic operations with big n
«
Reply #1 on:
November 19, 2007, 10:25:34 pm »
An integer can go up to 2,147,483,647 .
Use int64 instead of integer, which can go up to 9,223,372,036,854,775,807.
Hope this helps.
Logged
Tommi
Sr. Member
Posts: 256
Lazarus appear to wrong arithmetic operations with big nums.
«
Reply #2 on:
November 20, 2007, 08:59:03 am »
I tried but it's the same.
In anycase Integer is also int64. (
http://www.freepascal.org/docs-html/ref/refsu5.html#x25-240003.1.1
)
Temporarily I solved so:
for cc := 1 to 256 do x:=x+a; //the same as x:=a*256;
It works, but is very bad
Logged
arnoldb
Jr. Member
Posts: 97
Lazarus appear to wrong arithmetic operations with big nums.
«
Reply #3 on:
November 20, 2007, 11:52:48 am »
It depends on the CPU target...
If you are compiling for I386 (default), integer is only 2 bytes and not the same as int64.
If you set your cpu target to Pentium Pro/ Pentium 2 in menu Project->Compiler Options->Code->Target i386, then FPC compiles for a 4-byte integer, which is the same as int64.
Hope this helps
Logged
Marc
Administrator
Hero Member
Posts: 2674
Lazarus appear to wrong arithmetic operations with big nums.
«
Reply #4 on:
November 20, 2007, 12:09:46 pm »
in default mode (when no mode is specified) and interg is 16 bit (2 bytes)
In $mode objfpc (which all lazarus units are, see top of file) or in $mode delphi an integer is 32bit (4 bytes) indipendent of the CPU used
an int64 is allways 64 bit (8 bytes).
Logged
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the
bug tracker
Tommi
Sr. Member
Posts: 256
Lazarus appear to wrong arithmetic operations with big nums.
«
Reply #5 on:
November 22, 2007, 08:19:33 pm »
Thank You, Issue is solved.
Logged
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Using the Lazarus IDE
»
General
»
Lazarus appear to wrong arithmetic operations with big nums.
TinyPortal
© 2005-2018