What every computer scientist should know about floating-point arithmetic (1991) [pdf]
1–10 of 55 posts
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#2Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#3What Every Computer Scientist Should Know About Floating-Point Arithmetic - https://news.ycombinator.com/item?id=3808168 - April 2012 (3 comments)
What Every Computer Scientist Should Know About Floating-Point Arithmetic - https://news.ycombinator.com/item?id=1982332 - Dec 2010 (14 comments)
What Every Computer Scientist Should Know About Floating-Point Arithmetic - https://news.ycombinator.com/item?id=1746797 - Oct 2010 (2 comments)
Weekend project: What Every Programmer Should Know About FP Arithmetic - https://news.ycombinator.com/item?id=1257610 - April 2010 (9 comments)
What every computer scientist should know about floating-point arithmetic - https://news.ycombinator.com/item?id=687604 - July 2009 (2 comments)
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#4Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#5One thing that really did it for me was programming something where you would normally use floats (audio/DSP) on a platform where floats were abysmally slow. This forced me to explore Fixed-Point options which in turn forced me to explore what the differences to floats are.
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#6 > 0.1 + 0.1 + 0.1 == 0.3
False
I always tell my students that if they (might) have a float, and are using the `==` operator, they're doing something wrong.Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#7> 0.1 + 0.1 + 0.1 == 0.3 False I always tell my students that if they (might) have a float, and are using the `==` operator, they're doing something wrong.
[1]: https://www.cs.uaf.edu/2011/fall/cs301/lecture/11_09_weird_f... (division result matrix)
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#8> 0.1 + 0.1 + 0.1 == 0.3 False I always tell my students that if they (might) have a float, and are using the `==` operator, they're doing something wrong.
You should be using == for floats when they're actually equal. 0.1 just isn't an actual number.
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#9> 0.1 + 0.1 + 0.1 == 0.3 False I always tell my students that if they (might) have a float, and are using the `==` operator, they're doing something wrong.
.125 + .375 == .5 You should be using == for floats when they're actually equal. 0.1 just isn't an actual number.
A finitist computer scientists only accepts those numbers as real that can be expressed exactly in finite base-two floating point?
Re: What every computer scientist should know about floating-point arithmetic (1991) [pdf]
#10> 0.1 + 0.1 + 0.1 == 0.3 False I always tell my students that if they (might) have a float, and are using the `==` operator, they're doing something wrong.
0x1.999999999999ap-4 ("0.1")
+0x1.999999999999ap-4 ("0.1")
---------------------
=0x3.3333333333334p-4 ("0.2")
+0x1.999999999999ap-4 ("0.1")
---------------------
=0x4.cccccccccccf0p-4 ("0.30000000000000004")
!=0x4.cccccccccccccp-4 ("0.3")