diff options
author | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-07-28 21:06:37 +0000 |
---|---|---|
committer | florian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2019-07-28 21:06:37 +0000 |
commit | ff8fa4461a5ac7d0673d1fff9f3af54dd0977d02 (patch) | |
tree | 241953ac9f01fe4d84d7c8e0e92aac74a27f2fa0 /tests/webtbs/tw35878.pp | |
parent | 3bc22edbd2fb539070dea8be47de7451980f70a1 (diff) | |
download | fpc-ff8fa4461a5ac7d0673d1fff9f3af54dd0977d02.tar.gz |
* compilation of tests on 32 bit targets fixed, using while loops so keeping the type sizes
git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@42526 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/webtbs/tw35878.pp')
-rw-r--r-- | tests/webtbs/tw35878.pp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/tests/webtbs/tw35878.pp b/tests/webtbs/tw35878.pp index 17f435d64f..32be1ac4a7 100644 --- a/tests/webtbs/tw35878.pp +++ b/tests/webtbs/tw35878.pp @@ -4,8 +4,8 @@ program random_test; const l: UInt64 = 6148914691236517205; var - s,n: UInt32; - i,j: UInt32; + s,n: UInt64; + i,j: UInt64; begin WriteLn('Experiment:', LineEnding); WriteLn(' Draw a natural number r from the intervall [0,l-1] and'); @@ -16,14 +16,20 @@ begin WriteLn('Input size n':16, 'Observed ratio s/n':30); l := 6148914691236517205; - for j := 4 to 18 do + j := 4; + while j <= 18 do begin - n := (Int32(1) shl j); + n := (UInt64(1) shl j); s := 0; - for i := 0 to n-1 do - if Random(Int64(l)) < l div 2 then - Inc(s); + i := 0; + while i <= n-1 do + begin + if Random(Int64(l)) < l div 2 then + Inc(s); + Inc(i); + end; WriteLn( (UInt64(1) shl j):16, s/n:30); + Inc(j); end; if abs(0.5-(s/n))>0.1 then halt(1); |