Форум: "Начинающим";
Текущий архив: 2008.11.02;
Скачать: [xml.tar.bz2];
ВнизReal or Double Найти похожие ветки
← →
LDV (2008-09-24 13:43) [0]На многих форумах пишут что не рекомендуется в программа использовать тип Real (так как он не актуален) а вместо него указывать double. У меня как у новичка возникает вопрос почему? Хотелось бы узнать поподробнее ?
← →
Ega23 © (2008-09-24 13:45) [1]
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
Extended 3.6 x 10^-4951 .. 1.1 x 10^4932 19-20 10
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.
Generic real types
Type Range Significant digits Size in bytes
Real 5.0 x 10^-324 .. 1.7 x 10^308 15-16 8
Note
The six-byte Real48 type was called Real in earlier versions of Object Pascal. If you are recompiling code that uses the older, six-byte Real type in Delphi, you may want to change it to Real48. You can also use the {$REALCOMPATIBILITY ON} compiler directive to turn Real back into the six-byte type.
The following remarks apply to fundamental real types.
Real48is maintained for backward compatibility. Since its storage format is not native to the Intel processor architecture, it results in slower performance than other floating-point types.
Extendedoffers greater precision than other real types but is less portable. Be careful using Extended if you are creating data files to share across platforms.
The Comp (computational) type is native to the Intel processor architecture and represents a 64-bit integer. It is classified as a real, however, because it does not behave like an ordinal type. (For example, you cannot increment or decrement a Comp value.) Comp is maintained for backward compatibility only. Use the Int64 type for better performance.
Currencyis a fixed-point data type that minimizes rounding errors in monetary calculations. It is stored as a scaled 64-bit integer with the four least significant digits implicitly representing decimal places. When mixed with other real types in assignments and expressions, Currency values are automatically divided or multiplied by 10000.
← →
Поросенок Винни-Пух © (2008-09-24 13:49) [2]Сейчас real эквивалентен даблу. как string эквивалентен ansistring
А настоящий неудобный для процессора реал это real48
← →
Anatoly Podgoretsky © (2008-09-24 13:51) [3]> LDV (24.09.2008 13:43:00) [0]
Ерунду пишут, наверно в Турпо Паскале программируют или в очень равных версиях Дельфи.
В современых версиях между ними вообще нельзя ставить знак равенства, поскольку первое общий тип (generic) тип, а второе фундаментальный тип.
В качестве первого может быть любой другой тип, например Singlr/Real48/Double и даже string
← →
Anatoly Podgoretsky © (2008-09-24 14:40) [4]> Поросенок Винни-Пух (24.09.2008 13:49:02) [2]
> как string эквивалентен ansistring
Уже не актуально, string теперь эквивалентен widestring
Страницы: 1 вся ветка
Форум: "Начинающим";
Текущий архив: 2008.11.02;
Скачать: [xml.tar.bz2];
Память: 0.45 MB
Время: 0.006 c