Просмотреть всю тему ""Поймать" ГСЧ - реально?" »»
Re: "Поймать" ГСЧ - реально?   ID:19688   ответ на 19671 Чт, 29 июня 2006 18:35 [#]
CLON Форумы CasinoGames
Sharky писал чт, 29 июня 2006 18:12
Зачем тебе тип extended, если результат будет целочисленный?
Ответ: целочисленные типы не позволяют решить задачу из-за ограниченности диаппазонов.

Цитата из Делфи:
An integer type represents a subset of the whole numbers. The generic integer types are Integer and Cardinal; use these whenever possible, since they result in the best performance for the underlying CPU and operating system. The table below gives their ranges and storage formats for the current 32-bit Delphi compiler.

Generic integer types for 32-bit implementations of Delphi
Type Range Format
Integer -2147483648..2147483647 signed 32-bit
Cardinal 0..4294967295 unsigned 32-bit
Fundamental integer types include Shortint, Smallint, Longint, Int64, Byte, Word, and Longword.

Fundamental integer types
Type Range Format
Shortint -128..127 signed 8-bit
Smallint -32768..32767 signed 16-bit
Longint -2147483648..2147483647 signed 32-bit
Int64 -2^63..2^63-1 signed 64-bit
Byte 0..255 unsigned 8-bit
Word 0..65535 unsigned 16-bit
Longword 0..4294967295 unsigned 32-bit
In general, arithmetic operations on integers return a value of type Integer--which, in its current implementation, is equivalent to the 32-bit Longint. Operations return a value of type Int64 only when performed on one or more Int64 operand. Hence the following code produces incorrect results.

Зато вещественные числа имеют более широкие диаппазоны.
Цитата из "Делфи":
A real type defines a set of numbers that can be represented with floating-point notation. The table below gives the ranges and storage formats for the fundamental real types.

Fundamental real types
Type Range Significant digits Size in bytes
Real48 2.9 x 10^-39 .. 1.7 x 10^38 11-12 6
Single 1.5 x 10^-45 .. 3.4 x 10^38 7-8 4
Double 5.0 x 10^-324 .. 1.7 x 10^308 15-16 8
<font color="red">Extended 3.6 x 10^-4951 .. 1.1 x 10^4932 19-20 10</font>
Comp -2^63+1 .. 2^63 -1 19-20 8
Currency -922337203685477.5808.. 922337203685477.5807 19-20 8
The generic type Real, in its current implementation, is equivalent to Double.

Этим и обьясняется "необходимость" использовать "Экстендед" вместо "Интеджер".