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
I hope FreePascal can sup...
by
xiyi0616
[
Today
at 03:57:43 am]
Weird error
by
n7800
[
Today
at 02:31:23 am]
How to merge multiple cla...
by
cdbc
[
Today
at 02:16:37 am]
Remote desktop software i...
by
Boleeman
[
Today
at 12:59:14 am]
AI assisted translation o...
by
schuler
[April 13, 2026, 10:41:29 pm]
FPC Unleashed (inline var...
by
Fibonacci
[April 13, 2026, 09:21:04 pm]
fp-h2pas: New C header tr...
by
Gustavo 'Gus' Carreno
[April 13, 2026, 06:32:22 pm]
Nezplug Library Player
by
Gigatron
[April 13, 2026, 04:15:33 pm]
Eschecs (UCI chess GUI) 5...
by
Roland57
[April 13, 2026, 04:10:12 pm]
[ANN] fpGUI Toolkit v2.0....
by
cdbc
[April 13, 2026, 03:14:21 pm]
Lazarus Bugfix Release 4....
by
dbannon
[April 13, 2026, 01:52:18 pm]
Strange happenings with T...
by
jamie
[April 13, 2026, 12:41:42 pm]
Little bit...
by
jamie
[April 13, 2026, 12:17:43 pm]
Necromancer's Dos Navigat...
by
dbannon
[April 13, 2026, 11:03:26 am]
Can't pass string to TEdi...
by
cdbc
[April 13, 2026, 10:13:44 am]
Fixed Bzip2 unpacker from...
by
domasz
[April 13, 2026, 08:09:54 am]
Ann: DeCoperators
by
Thaddy
[April 13, 2026, 07:37:29 am]
Bad Sandwich
by
Guva
[April 12, 2026, 09:55:25 pm]
ZeosDB and sqlite3
by
dseligo
[April 12, 2026, 09:06:22 pm]
The ever re-appearing /= ...
by
Thaddy
[April 12, 2026, 08:07:09 pm]
Some Lazarus Graphics Rel...
by
Boleeman
[April 12, 2026, 03:45:30 pm]
Some Lazarus Utils N Stuf...
by
Boleeman
[April 12, 2026, 03:39:45 pm]
Ann: Deinline: a de-inlin...
by
Fred vS
[April 12, 2026, 03:17:40 pm]
BAScript - Simple scripti...
by
Ñuño_Martínez
[April 12, 2026, 01:00:21 pm]
NiceGrid component for La...
by
Alexandr R
[April 12, 2026, 11:02:54 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Lazarus appear to wrong arithmetic operations with big nums. (Read 5318 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: 2680
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