Тёмный

C++ floating point data types [5] 

Professor Hank Stalica
Подписаться 18 тыс.
Просмотров 1,5 тыс.
50% 1

Опубликовано:

 

4 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 2   
@PauseBoden
@PauseBoden Год назад
I love your videos, thank you! I'm a bit confused about something in this video though. At around 7:46 you say that 3.6 is stored as a double but it's being truncated to a float. Isn't 3.6 a float? I guess I don't understand why, if 3.6 is within the range of float and f has been defined as a floating-point data type variable, the value 3.6 wouldn't be stored as float?
@ProfessorHankStalica
@ProfessorHankStalica Год назад
Literals are stored in memory as doubles by C++. That's 8 bytes. A float variable is 4 bytes. So if you assign 3.6 to a float variable, 4 bytes get cut off. Now, in this case, who cares because 3.6 doesn't require all 8 bytes to store correctly. However, if you stored something like a bunch of digits for PI, then you might lose some of those decimal places when you lose the 4 bytes.
Далее
这位大哥以后恐怕都不敢再插队了吧…
00:16
Naming Things in Code
7:25
Просмотров 2,1 млн
Why Computers Screw up Floating Point Math
12:10
Просмотров 337 тыс.
Use Arc Instead of Vec
15:21
Просмотров 147 тыс.
Being Competent With Coding Is More Fun
11:13
Просмотров 89 тыс.
Floating Point Numbers - Computerphile
9:16
Просмотров 2,3 млн
Master Pointers in C:  10X Your C Coding!
14:12
Просмотров 312 тыс.