Floating Point Assignment Fails
Assignment: Using floating point numbers, prove that: 0.1 + 0.2 = 0.3 BONUS POINTS if you use 17 digits of accuracy AFTER 3 FAILED ATTEMPTS WE WILL POWER DOWN YOUR COMPUTER #include <stdio.h> int main(int argc, char **argv) { float a = 0.1; float b = 0.2; } gcc -o floats homework.c ./floats 0.300000 0.30000000000000004 2/3 Attempts
A programmer works through an assignment requiring floating-point arithmetic to prove that 0.1 + 0.2 equals 0.3. The code appears to produce 0.300000, but a later calculation exposes the familiar floating-point precision error as 0.30000000000000004, leaving the programmer two-thirds of the way through the attempts before the computer powers down. Upbeat electronic music and a weary sigh make the escalating frustration and absurdly threatening homework assignment feel like a comedic programming reaction. EN: A programmer works through an assignment requiring floating-point arithmetic to prove that 0.1 + 0.2 equals 0.3. The code appears to produce 0.300000, but a later calculation exposes the familiar floating-point precision error as 0.30000000000000004, leaving the programmer two-thirds of the way through the attempts before the computer powers down. Upbeat electronic music and a weary sigh make the escalating frustration and absurdly threatening homework assignment feel like a comedic programming reaction.
- @gentoomemes / 459 2022-06-04
- Type
- video, 1:14
- Size
- 1280×720 · 2.7 MiB
- Mood
- frustrated, absurd
- Language
- en
- Added