You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/20-arithmetics/43-float/en/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
In mathematics there are different types of numbers. For example:
2
2
3
3
- Natural numbers: positive integers: 1, 2, 3, and so on.
4
-
-Rational numbers: fractional numbers that can be represented as a division, for example: 0.5, 1.75, 3.14.
4
+
-Fractional numbers: numbers with a fractional part, for example: 0.5, 1.75, 3.14.
5
5
6
6
From the point of view of mathematics, everything is simple. But from the computer's point of view, there is a real chasm between these types of numbers. Try to solve mentally: what is `0.2` + `0.1`? Obviously, `0.3`. PHP will show the same when printing:
This behavior is typical for Python, JavaScript, and most other programming languages.
34
34
35
-
The reason lies in how computers work. A computer operates with limited memory, while rational numbers are infinitely precise. Infinitely many other numbers can fit between 0.1 and 0.2. But a computer cannot store infinity. It approximates the number, trying to fit it into the available number of bits.
35
+
The reason lies in how computers work. A computer operates with limited memory, while there are infinitely many fractional numbers: as many as you like fit between 0.1 and 0.2. A computer cannot store infinity, so it approximates the number, trying to fit it into the available number of bits.
36
36
37
37
Such approximate values are called floating point numbers. Their storage and calculations follow strict rules described in a special standard, IEEE 754, which most programming languages rely on.
Copy file name to clipboardExpand all lines: modules/20-arithmetics/43-float/es/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
En matemáticas hay diferentes tipos de números. Por ejemplo:
2
2
3
3
- Naturales: números enteros positivos: 1, 2, 3, etc.
4
-
-Racionales: números fraccionarios que se pueden representar como una división, por ejemplo: 0.5, 1.75, 3.14.
4
+
-Fraccionarios: números con parte decimal, por ejemplo: 0.5, 1.75, 3.14.
5
5
6
6
Desde el punto de vista de las matemáticas, todo es simple. Pero desde el punto de vista de la computadora, entre estos tipos de números hay un verdadero abismo. Intenta resolver mentalmente: ¿cuánto es `0.2` + `0.1`? Obviamente, `0.3`. PHP mostrará lo mismo al imprimir:
Este comportamiento es típico de Python, JavaScript y la mayoría de los demás lenguajes de programación.
34
34
35
-
La razón está en el funcionamiento de la computadora. Una computadora trabaja con memoria limitada, mientras que los números racionales son infinitamente precisos. Entre 0.1 y 0.2 se pueden colocar infinitos números. Pero la computadora no puede almacenar el infinito. Aproxima el número, tratando de ajustarlo a la cantidad de bits disponible.
35
+
La razón está en el funcionamiento de la computadora. Una computadora trabaja con memoria limitada, mientras que los números fraccionarios son infinitos: entre 0.1 y 0.2 se pueden colocar cuantos se quiera. La computadora no puede almacenar el infinito, así que aproxima el número, tratando de ajustarlo a la cantidad de bits disponible.
36
36
37
37
Estos valores aproximados se llaman números de punto flotante (floating point numbers). Su almacenamiento y los cálculos con ellos siguen reglas estrictas descritas en un estándar especial, IEEE 754, en el que se basan la mayoría de los lenguajes de programación.
Copy file name to clipboardExpand all lines: modules/20-arithmetics/43-float/ru/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
В математике есть разные типы чисел. Например:
2
2
3
3
- Натуральные: целые положительные числа: 1, 2, 3 и т.д.
4
-
-Рациональные: дробные числа, которые можно представить в виде деления, например: 0.5, 1.75, 3.14.
4
+
-Дробные: числа с дробной частью, например: 0.5, 1.75, 3.14.
5
5
6
6
С точки зрения математики все просто. Но с точки зрения компьютера между этими типами чисел лежит настоящая пропасть. Попробуйте мысленно решить: сколько будет `0.2` + `0.1`? Очевидно, `0.3`. PHP при выводе покажет то же самое:
Такое поведение характерно для Python, JavaScript и большинства других языков программирования.
34
34
35
-
Причина в устройстве компьютера. Компьютер работает с ограниченной памятью, тогда как рациональные числа бесконечно точны. Между 0.1 и 0.2 можно поместить бесконечно много других чисел. Но компьютер не может хранить бесконечность. Он приближает число, стараясь уместить его в доступное количество бит.
35
+
Причина в устройстве компьютера. Компьютер работает с ограниченной памятью, а дробных чисел бесконечно много: между 0.1 и 0.2 можно поместить сколько угодно других. Хранить бесконечность компьютер не может, поэтому он приближает число, стараясь уместить его в доступное количество бит.
36
36
37
37
Такие приближенные значения называются числами с плавающей точкой (floating point numbers). Хранение и вычисления с ними подчиняются строгим правилам, описанным в специальном стандарте IEEE 754, на который ориентируются большинство языков программирования.
Copy file name to clipboardExpand all lines: modules/33-data-types/40-primitive-data-types/en/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ For example:
4
4
5
5
- "Hello, World!" is a string (`string`)
6
6
- 7, -198, 0 are integers (`int`)
7
-
- 3.14, -0.01, 1.0 are rational numbers (`float`)
7
+
- 3.14, -0.01, 1.0 are floating point numbers (`float`)
8
8
9
9
## What is a data type?
10
10
@@ -50,12 +50,12 @@ On the screen the result looks the same, but inside the program these are comple
50
50
51
51
The number `5` and the string `'5'` are different values, and operations with them work differently. That said, when types don't match, PHP often tries to convert one type into another on its own. How convenient this is and what makes it dangerous we'll look at a bit later in this module.
52
52
53
-
## Integers and rational numbers
53
+
## Integers and fractional numbers
54
54
55
55
PHP distinguishes between two kinds of numbers:
56
56
57
57
-`int` denotes integers: -3, 0, 7, 100000
58
-
-`float` denotes real (rational) numbers: 1.0, -3.14, 2.718
58
+
-`float` denotes fractional numbers, also called floating point numbers: 1.0, -3.14, 2.718
59
59
60
60
This division is due to the peculiarities of how computers are built — we talked about this in the lesson about floating-point numbers.
61
61
@@ -84,7 +84,7 @@ Types such as:
84
84
85
85
- string,
86
86
- int (integer),
87
-
- float (rational number)
87
+
- float (floating point number)
88
88
89
89
are called primitive: they are built right into the PHP language itself.
Copy file name to clipboardExpand all lines: modules/33-data-types/40-primitive-data-types/es/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Por ejemplo:
4
4
5
5
- "Hello, World!" es una cadena de texto (`string`)
6
6
- 7, -198, 0 son números enteros (`int`)
7
-
- 3.14, -0.01, 1.0 son números racionales (`float`)
7
+
- 3.14, -0.01, 1.0 son números de punto flotante (`float`)
8
8
9
9
## ¿Qué es un tipo de dato?
10
10
@@ -50,12 +50,12 @@ En la pantalla el resultado se ve igual, pero dentro del programa son cosas comp
50
50
51
51
El número `5` y la cadena `'5'` son valores diferentes, y las operaciones con ellos funcionan de forma distinta. Eso sí, cuando los tipos no coinciden, PHP a menudo intenta convertir un tipo en otro por sí mismo. Qué tan cómodo es esto y por qué es peligroso lo veremos un poco más adelante en este módulo.
52
52
53
-
## Números enteros y racionales
53
+
## Números enteros y fraccionarios
54
54
55
55
PHP distingue dos clases de números:
56
56
57
57
-`int` designa los números enteros: -3, 0, 7, 100000
58
-
-`float` designa los números reales (racionales): 1.0, -3.14, 2.718
58
+
-`float` designa los números fraccionarios, también llamados números de punto flotante: 1.0, -3.14, 2.718
59
59
60
60
Esta separación está relacionada con las particularidades de cómo están construidos los ordenadores — hablamos de ello en la lección sobre los números de punto flotante.
61
61
@@ -84,7 +84,7 @@ Los tipos como:
84
84
85
85
- string (cadena de texto),
86
86
- int (número entero),
87
-
- float (número racional)
87
+
- float (número de punto flotante)
88
88
89
89
se llaman primitivos: están incorporados directamente en el propio lenguaje PHP.
0 commit comments