floating point literal
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Плавающей точкой литерал определяет константу времени компиляции, значение которого указано в исходном файле.
Original:
Floating point literal defines a compile-time constant whose value is specified in the source file.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Синтаксис
Плавающей точкой литералы имеют два синтаксиса. Первый из них состоит из следующих частей:
Original:
A floating-point literals have two syntaxes. The first one consists of the following parts:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- непустая последовательность десятичных цифр, содержащую символ десятичной точки (определяется значительным)Original:nonempty sequence of decimal digits containing a decimal point character (defines significant)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (необязательно)
eилиEзатем с дополнительным минусом или плюсом и непустая последовательность десятичных цифр (определяет показатель степени)Original:(необязательно)eorEfollowed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (необязательно) спецификатор суффикс типа
l,f,LилиFOriginal:(необязательно) a suffix type specifier as al,f,LorFThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
Вторая состоит из следующих частей:
Original:
The second one consists of the following parts:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- непустая последовательность десятичных цифр (определяется значительным)Original:nonempty sequence of decimal digits (defines significant)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
eилиEзатем с дополнительным минусом или плюсом и непустая последовательность десятичных цифр (определяет показатель степени)Original:eorEfollowed with optional minus or plus sign and nonempty sequence of decimal digits (defines exponent)The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - (необязательно) спецификатор суффикс типа
l,f,LилиFOriginal:(необязательно) a suffix type specifier as al,f,LorFThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
Суффикс спецификатор типа определяет фактический тип с плавающей точкой буквально
Original:
The suffix type specifier defines the actual type of the floating-point literal:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- (Без суффикса) определяет doubleOriginal:(no suffix) defines doubleThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
f Fопределяет floatOriginal:f Fdefines floatThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. -
l Lопределяет long doubleOriginal:l Ldefines long doubleThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
-
[править] Объяснение
Десятичное используется научная нотация, это означает, что показатель сила 10, на который существенным является multiplied.
Original:
A decimal scientific notation is used, meaning that the exponent is the power of 10 by which the significant is multiplied.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Математический смысл 123e4 является 123 × 10 4 </ SUP></div>
Original:
The mathematical meaning of 123e4 is 123×104
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[править] Пример
std::cout << 123.456e-67 << '\n' << .1E4f << '\n' << 58. << '\n' << 4e2 << '\n';
Вывод:
1.23456e-65 1000 58 400