Модуль: (C++) Real numbers


Задача

1/10

Real numbers

Теория

Real numbers

float f = 6.5;
double r = 5.0;

The value 5.0 is a number represented as a decimal fraction (has an integer and fractional part). In computer science, such numbers are called float numbers.
A float is a data type composed of a number that is not an integer, because it includes a fraction represented in decimal format. The integer and fractional parts are separated by a dot, not a comma, as in mathematics.
Even if the fractional part of the number is zero, as in the variable r in the example, the translator will still create a real variable in memory. The point, as it were, is a signal for the translator that it is necessary to create a real variable.

Very large and very small numbers are written using a "floating point" (in the so-called scientific format).

In a scientific format, the number is represented in the form of a mantissa (a significant part of the number) and order. When recording, the mantissa and the order are separated from each other by the letter e (denotes 10 to some extent).
For example, you can save the value of the electron charge (\(1,60217662 \times 10^{-19}\)) in a variable by writing in the following form
float El = 1.60217662e-19 # for a positive order, the + sign can be omitted
Almost all real numbers cannot be stored in computer memory with perfect accuracy, since a limited number of bits are allocated for their storage. Therefore, in calculations with real numbers, errors associated with inaccuracy of the representation are accumulated. Moreover, the less space is allocated, the greater this error will be. In order to reduce the error in C ++, they use the double type, which stores a real number with double precision in memory (it takes eight bytes in memory, while the type float takes 4 bytes).

To get more accurate calculations, use the double type in the program.
 

Задача

The program outputs the number below in scientific format. Write it in the math form (use a dot as a separator for the integer and fractional parts)
\(1.2345e+001\)

Выберите правильный ответ, либо введите его в поле ввода

Комментарий учителя