Lo que todo programador debería saber sobre aritmética de punto flotante
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixxed issue #4 - broken links

+2 -2
+1 -1
content/basic.html
··· 4 4 5 5 ### Why don't my numbers, like 0.1 + 0.2 add up to a nice round 0.3, and instead I get a weird result like 0.30000000000000004? 6 6 7 - Because internally, computers use a format ([binary](/binary/) [floating-point](/formats/fp/)) that 7 + Because internally, computers use a format ([binary](/formats/binary/) [floating-point](/formats/fp/)) that 8 8 cannot accurately represent a number like 0.1, 0.2 or 0.3 *at all*. 9 9 10 10 When the code is compiled or interpreted, your "0.1" is already
+1 -1
content/errors/comparison.html
··· 2 2 title: Comparison 3 3 --- 4 4 5 - Due to rounding errors, most [floating-point](/format/fp/) numbers end up being slightly imprecise. As long as this 5 + Due to rounding errors, most [floating-point](/formats/fp/) numbers end up being slightly imprecise. As long as this 6 6 imprecision stays small, it can usually be ignored. However, it also means that numbers expected 7 7 to be equal (e.g. when calculating the same result through different correct methods) often differ 8 8 slightly, and a simple equality test fails. For example: